XSLT value-of

N

Nicole Szymanski

Hello,

I am developing a XML application that uses XSLT in order to transform
math lessons written in XML to XHTML. I write TEX equation between math
tags, for instance :

<math>a^2+b^2=c^2</math>

This code is transformed to MathML with OpenMathTag. The previous example
would give :

<math><msup><mi>a</mi><mn>2</mn>.... </math>

And eventually the XSL template is applied to the XML document. I use the
following XSL statement :

<xsl:template match="math">
<math displaystyle="true" xmlns="http://www.w3.org/1998/Math/MathML">
<xsl:value-of select="." />
</math>
</xsl:template>

Unfortunately this strips out all MathML tags. This is the output of the
previous example :

<math displaystyle="true" xmlns="http://www.w3.org/1998/Math/MathML">
a2+b2=c2
</math>

Do you know how I can have the XSL template just "copy" the code between
<math> and </math> tags without looking at it ?

I thought that the main difference between value-of and apply-templates
was that the former didn't recursively interpret node data unfortunately
this example seems to have proven me wrong.


Thanks in advance for help,
 
N

Nicole Szymanski

Cf. "Julian F. Reschke"
Use

xsl:copy-of select="node()"

instead.

Ok thanks alot.

Still, what is the difference between value-of and apply-templates ?
 
J

Julian F. Reschke

Nicole Szymanski said:
Cf. "Julian F. Reschke"


Ok thanks alot.

Still, what is the difference between value-of and apply-templates ?

value-of takes the string value, apply-templates let's template processing
happen. In the latter case it depends on the template you have defined for
the child elements.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top