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">&#10;</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">&#10;</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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -