Hi ,
I am using XSLT as below
<?xml version="1.0" ?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:
js="javascript
:code"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output method="xml" doctype-public="string" />
<msxsl:script implements-prefix="
js" language="javascript">
var i = 0;
function getnumber()
{
return i++;
}
</msxsl:script>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:attribute name="id"><xsl:value-of select="
js:getnumber()"></xsl:value-of></xsl:attribute>
<xsl:attribute name="xpathdata"><xsl:for-each select="ancestor::*">->
<xsl:value-of select="@name" /> [<xsl:number />]</xsl:for-each>->
/* I have problem with the below statement Actually name() fetches the node name
but i want the value of the node. So, If i uses <xsl:value-of select="." /> It fetches the concated text of current node +
nodes all the child nodes the current node. But I want value of the current node only. One solution can be using the element
name like <xsl:value-of select="nodename" /> but the problem is this code is generic and don't have any fixed element name.
Can anybody suggest some solution so that i can fetch the value of that node only.
*/
<xsl:value-of select="name()" />
[<xsl:number />]</xsl:attribute>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>Regards,
Sam