Nic Miloslav     Example 9    KEYWORDS      EXAMPLES      AUTHORS     

You can specify, that you want to process the element only if the element is a child of different element.


     XML     HOME     XSL 1      
<xslTutorial >
<pedestrian>
<firstName>Joe</firstName>
<surname>Smith</surname>
</pedestrian>
<driver>
<firstName>Alice</firstName>
<surname>Elton</surname>
</driver>
</xslTutorial>

     XSL 1     HOME     XML     HTML 1     OUTPUT 1     
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="driver/*">
<i><xsl:value-of select="."/></i>
</xsl:template>
<xsl:template match="pedestrian/*">
<B><xsl:value-of select="."/></B>
</xsl:template>
</xsl:stylesheet>

     HTML 1     HOME     XML     XSL 1     OUTPUT 1     
<B>Joe</B>
<B>Smith</B>
<i>Alice</i>
<i>Elton</i>

     OUTPUT 1     HOME     XML     XSL 1     HTML 1     
Joe Smith Alice Elton