===============================================
path.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<HTML>
<HEAD><TITLE></TITLE></HEAD>
<BODY>
<xsl:apply-templates select="Data/Object" />
</BODY>
</HTML>
</xsl:template>
<xsl:template match="Object">
Object is <xsl:value-of select="@Name"/>
<OL>
<xsl:apply-templates select="Property" />
</OL>
<xsl:apply-templates select="Object" />
</xsl:template>
<xsl:template match="Property" >
<LI><xsl:value-of select="@Name"/> = <xsl:value-of select="Value"/>
<P>Path to property is
<xsl:call-template name="fullpath"/>
</P>
</LI>
</xsl:template>
<xsl:template name="fullpath">
<xsl:for-each select="ancestor::*[1]">
<xsl:call-template name="fullpath"/>
</xsl:for-each>
<xsl:text>/</xsl:text>
<xsl:choose>
<xsl:when test="@Name">
<xsl:value-of select="@Name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="name()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Tidak ada komentar:
Posting Komentar