dbertoni 2003/01/24 10:26:24
Modified: c/samples/TransformToXercesDOM birds.xsl
Log:
Generate some elements instead of all text.
Revision Changes Path
1.2 +8 -19 xml-xalan/c/samples/TransformToXercesDOM/birds.xsl
Index: birds.xsl
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/TransformToXercesDOM/birds.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- birds.xsl 24 Jan 2003 02:33:41 -0000 1.1
+++ birds.xsl 24 Jan 2003 18:26:23 -0000 1.2
@@ -4,35 +4,24 @@
<xsl:template match="Class">
<BirdInfo>
- <xsl:apply-templates select="Order"/>
+ <xsl:apply-templates select="*"/>
</BirdInfo>
</xsl:template>
<xsl:template match="Order">
-Order is: <xsl:value-of select="@Name"/>
- <xsl:apply-templates select="Family"/><xsl:text>
-</xsl:text>
+ <xsl:element name="{@Name}">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
</xsl:template>
<xsl:template match="Family">
- Family is: <xsl:value-of select="@Name"/>
- <xsl:apply-templates select="Species | SubFamily | text()"/>
-</xsl:template>
-
-<xsl:template match="SubFamily">
- SubFamily is <xsl:value-of select="@Name"/>
- <xsl:apply-templates select="Species | text()"/>
+ <xsl:element name="{@Name}">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
</xsl:template>
<xsl:template match="Species">
- <xsl:choose>
- <xsl:when test="name(..)='SubFamily'">
- <xsl:text> </xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text><xsl:value-of select="@Scientific_Name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/><xsl:text> </xsl:text><xsl:value-of
select="@Scientific_Name"/>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]