<ROOT>
<A>
<B>TESTING</B>
</A>
</ROOT>
XSL:
<xsl:variable name="nodestring" select="//A"/>
<xsl:value-of select="$nodestring"/>
I am trying to convert XML nodeset to string using XSL. Any thoughts?
<ROOT>
<A>
<B>TESTING</B>
</A>
</ROOT>
XSL:
<xsl:variable name="nodestring" select="//A"/>
<xsl:value-of select="$nodestring"/>
I am trying to convert XML nodeset to string using XSL. Any thoughts?
About "convert Node to String"
With XSLT 1.0, you can use the XPath1.0
string()
function of the Core Function Library, that converts a node to a string:See "Function: string string(object)" at section 4.3.
About "convert Node to XML pretty-printer"
It this another question, about "XML pretty-printer" or "XML dump" ... See good answers here.
Saxon required for following solution. I find it here
You need to serialize the nodes. The most simple for your example would be something like
The above serializer templates do not handle e.g. attributes, namespaces, or reserved characters in text nodes, but the concept should be clear. XSLT process works on a node tree and if you need to have access to "tags", you need to serialize the nodes.