Select multiple child nodes
Posted: Thu Nov 13, 2008 4:15 pm
I'm fairly new to XSLT, and struggeling with something that I think should be really simple.
Given the following XML, how can you select the last w:r-element only? (I want to tag the last text with "BoldItalic". )
Given the following XML, how can you select the last w:r-element only? (I want to tag the last text with "BoldItalic". )
Code: Select all
<w:p>
<w:r>
<w:rPr>
<w:i/>
</rPr>
<w:t>Some italic text, </w:t>
</w:r>
<w:r>
<w:rPr>
<w:b/>
</rPr>
<w:t>followed by bold text</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:rPr>
<w:i/>
<w:b/>
</rPr>
<w:t>But what about both?</w:t>
</w:r>
</w:p>
Code: Select all
<xsl:template match="w:r/w:rPr/w:i">
<!--do something here-->
</xsl:template>
<xsl:template match="w:r/w:rPr/w:b">
<!--do something here-->
</xsl:template>