[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML Question
LINKE Markus wrote:
I think I missunderstood something ... I think you use a rather complex stylesheet to accomplish your rather trivial task (imho). One of the steps missing is that you have to replace 'myNamespace' with your namespace, but it looks like you don't use a namespace at all. Let me give it a try with a simpler stylesheet that just processes your nodes (I happened to accidentally be working on something similar for a simple analysis function, a little tweaking gave me this): (make sure to have set xsl:output to text and call it using apply-templates with the right mode) (also note, as a convenience, I added two global params/variables to decide on whether you want to see the path growing and shrinking or not: $wind-up and $wind-down) <!-- this will process and output all nodenames as if these were paths it will NOT output the textual contents of the nodes. But you can add that yourself easily if you like. It does not require node-set and works for xslt 1.0 and 2.0 --> <xsl:template match="*" mode="nodenames"> <xsl:param name="current-path" select="''" /> <xsl:choose> <!-- 'End' of the xpath: no other children to parse --> <xsl:when test="not(./*)"> <xsl:text>&tab;</xsl:text> <xsl:value-of select="concat($current-path, '/', local-name())" /> <xsl:text>&newline;</xsl:text> </xsl:when> <!-- Still children to parse. --> <xsl:otherwise> <!-- Use global param to set winding/unwinding --> <xsl:if test="$wind-up = 'yes'"> <xsl:text>&tab;</xsl:text> <xsl:value-of select="concat($current-path, '/', local-name())" /> <xsl:text>&newline;</xsl:text> </xsl:if> <!-- Apply all children --> <xsl:apply-templates select="./*" mode="nodenames" > <xsl:with-param name="current-path" select="concat($current-path, '/', local-name())" /> </xsl:apply-templates> <!-- Use global param to set winding/unwinding --> <xsl:if test="$wind-down = 'yes'"> <xsl:text>&tab;</xsl:text> <xsl:value-of select="concat($current-path, '/', local-name())" /> <xsl:text>&newline;</xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:template>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|