[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML Question

Subject: Re: XML Question
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 04 Oct 2006 00:39:03 +0200
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>


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.