Nic Miloslav Example 8 | KEYWORDS EXAMPLES AUTHORS |
---|
Template can match from selection of location paths, individual paths being separated with |.(Stylesheet 1). Wildcard * selects all possibilities.Compare Stylesheet 1 with Stylesheet 2. Compare with Example 73.
XML | HOME XSL 1 XSL 2 |
---|
<xslTutorial > |
<employee> |
<firstName>Joe</firstName> |
<surname>Smith</surname> |
</employee> |
</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="firstName|surname"> |
<DIV><xsl:text> [template: </xsl:text> |
<xsl:value-of select="name()"/> |
<xsl:text> outputs </xsl:text> |
<xsl:apply-templates/ > |
<xsl:text> ]</xsl:text> </DIV> |
</xsl:template> |
</xsl:stylesheet> |
HTML 1 | HOME XML XSL 1 OUTPUT 1 |
---|
<DIV>[template: firstName outputs Joe ]</DIV> |
<DIV>[template: surname outputs Smith ]</DIV> |
OUTPUT 1 | HOME XML XSL 1 HTML 1 |
---|
XSL 2 | HOME XML HTML 2 OUTPUT 2 |
---|
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> |
<xsl:template match="*"> |
<DIV><xsl:text> [template: </xsl:text> |
<xsl:value-of select="name()"/> |
<xsl:text> outputs </xsl:text> |
<xsl:apply-templates/ > |
<xsl:text> ]</xsl:text> </DIV> |
</xsl:template> |
</xsl:stylesheet> |
HTML 2 | HOME XML XSL 2 OUTPUT 2 |
---|
<DIV>[template: xslTutorial outputs |
<DIV>[template: employee outputs |
<DIV>[template: firstName outputs Joe ]</DIV> |
<DIV>[template: surname outputs Smith ]</DIV> ]</DIV> ]</DIV> |
OUTPUT 2 | HOME XML XSL 2 HTML 2 |
---|