XSLT value-of

Discussion in 'XML' started by Nicole Szymanski, Jul 10, 2003.

  1. 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,
    --
    Nicole
     
    Nicole Szymanski, Jul 10, 2003
    #1
    1. Advertising

  2. Use

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

    instead.

    "Nicole Szymanski" <> schrieb im Newsbeitrag
    news:Xns93B4C97CE7244nmpsnmpsinvalid@213.228.0.75...
    > 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,
    > --
    > Nicole
     
    Julian F. Reschke, Jul 10, 2003
    #2
    1. Advertising

  3. Cf. news:bekbbo$629q0$-berlin.de, "Julian F. Reschke"
    <> :

    > Use
    >
    > xsl:copy-of select="node()"
    >
    > instead.


    Ok thanks alot.

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

    --
    Nicole
     
    Nicole Szymanski, Jul 10, 2003
    #3
  4. "Nicole Szymanski" <> schrieb im Newsbeitrag
    news:Xns93B4D771D2A1Bnmpsnmpsinvalid@213.228.0.133...
    > Cf. news:bekbbo$629q0$-berlin.de, "Julian F. Reschke"
    > <> :
    >
    > > Use
    > >
    > > xsl:copy-of select="node()"
    > >
    > > instead.

    >
    > 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.
     
    Julian F. Reschke, Jul 10, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    702
    Stylus Studio
    Aug 3, 2004
  2. Benjamin Hillsley
    Replies:
    3
    Views:
    1,696
    Dimitre Novatchev
    Sep 25, 2003
  3. ted
    Replies:
    1
    Views:
    631
    Laurens
    Jan 26, 2004
  4. Replies:
    2
    Views:
    727
    Henry S. Thompson
    Oct 19, 2005
  5. =?UTF-8?b?5byg6Z+h5q2m?=
    Replies:
    3
    Views:
    712
    DeepthiShri
    Oct 23, 2006
Loading...

Share This Page