This XSL template "showAll" will show the contents of a node.
Call it this way:
<xsl:call-template name="showAll">
<xsl:with-param name="showText" select="1" />
</xsl:call-template>
Where the param "showText" decides if you wish to see the text contents from
the nodes.
Here is the template:
<xsl:template name="showAll">
<xsl:param name="showText" />
<div style="padding-left: 10px; border-left: dotted 1px #e0e0e0;">
<xsl:for-each select="*">
<div style="padding-left: 10px;">
<<xsl:value-of select="name(.)"/>
<xsl:for-each select="@*">
 <xsl:value-of select="name(.)"/>="<xsl:value-of select="."/>"
</xsl:for-each>>
<xsl:if test="$showText=1">
<xsl:value-of select="text()"/>
</xsl:if>
<xsl:if test ="count(*)>0">
<br />
<xsl:call-template name="showAll">
<xsl:with-param name="showText" select="$showText" />
</xsl:call-template>
</xsl:if>
<xsl:if test ="string-length(.)=0
and $showText!=1">
/><br />
</xsl:if>
<xsl:if test ="string-length(.)>0">
</<xsl:value-of select="name(.)" />><br />
</xsl:if>
</div>
</xsl:for-each>
</div>
</xsl:template>
No comments:
Post a Comment