xslt - xsl - Get all attributes from childs -
i'm having trouble getting attributes parent tag, , childs. xml:
<macro name="editor"> <names variable="editor" delimiter=", "> <name and="symbol" delimiter=", "/> <label form="short" prefix=" (" text-case="lowercase" suffix=".)" /> </names> </macro>
i want able , attributes childnodes. have:
<xsl:for-each select="macro"> <xsl:value-of select="@*" /> <br /> </xsl:for-each>
how want turn out:
editor
names editor,
name symbol,
label short ( lowercase .)
when xslt transformation
<?xml version='1.0'?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="text"/> <xsl:template match="macro"> <xsl:value-of select="@name"/> <xsl:for-each select="child::*"> <xsl:text disable-output-escaping="yes"> </xsl:text> <xsl:value-of select="name(.)"/> <xsl:text> </xsl:text> <xsl:value-of select="@*" separator=""/> <xsl:for-each select="child::*"> <xsl:text disable-output-escaping="yes"> </xsl:text> <xsl:value-of select="name(.)"/> <xsl:text> </xsl:text> <xsl:value-of select="@*" separator=""/> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet>
runs on below xml:
<macro name="editor"> <names variable="editor" delimiter=", "> <name and="symbol" delimiter=", "/> <label form="short" prefix=" (" text-case="lowercase" suffix=".)" /> </names> </macro>
gives required output:
editor names editor, name symbol, label short (lowercase.)
Comments
Post a Comment