I am new to xslt.
Kindly see the below cases :
Input :
<?xml version="1.0"?> <Hello> <hi> <hii> shashi </hii> </hi> </Hello> Case 1 :
Xslt Code :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> Output for Case 1 :
<?xml version="1.0"?> <Hello> <hi> <hii> shashi </hii> </hi> </Hello> Case 2 :
Xslt code :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:copy-of select="./hi"/> </xsl:template> </xsl:stylesheet> In case 2 there is no output shown.I am not getting why ?
<xsl:template match="/"> when this points to the root node that is Hello.Therefore in case 1 when it executes
<xsl:copy-of select="."/> This will print the entire xml.
In case 2 : when it executes
<xsl:copy-of select="./hi"/> it should print below.
<hi> <hii> shashi </hii> </hi> Can somebody please help on this?
Thanks, Shashiraj NK
No comments:
Post a Comment