Variations on this have been published, but I could not find any base case address. I thought it would be nice to have a canonical answer to the simplest version of the problem. This question suggests xslt 1.0.
I have an XML document containing mixed nodes, for example:
<paragraph>
This is some text that is <bold> bold </bold>
and this is some that is <italic> italicized. </italic>
</paragraph>
I would usually use a transform that looks something like this:
<xsl: template match = "bold">
<b><xsl:apply-templates/> </b>
</ xsl: template>
<xsl: template match = "italic">
<i><xsl:apply-templates/> </i>
</ xsl: template>
<xsl: template match = "paragraph">
<p><xsl:apply-templates/> </p>
</ xsl: template>
which works fine until I want to use disable-output-escaping = "yes", which is an xsl: value-of attribute. Is there a way to select the text part of the mixed node to which I can apply the value regardless of the embedded nodes?
This, of course, does not work, because I will lose the child nodes:
<xsl: template match = "paragraph">
<p> <xsl: value-of select = "." disable-output-escaping = "yes" /> </p>
</ xsl: template>
, , , , XML, XML () , XML- > XSLT- > HTML ( ).