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

RE: FW: Path Reversal

Subject: RE: FW: Path Reversal
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 29 Jan 2002 12:47:13 -0000
jokes about name andrew

I know there have been a few goes at this, but I thought I would do one as
well :)

This stylesheet recursively extracts each word of the path (the bits in
between the slashes) and then when its at the final word, selects the
content of the node using '//'.

It may help, i dunno....

<xsl:stylesheet version="1.0"

<xsl:template match="/">
<xsl:call-template name="text_wrapper">
   <xsl:with-param name="Text" select="'/funstuff/jokes/veryfunnyjoke'"/>

<xsl:template name="text_wrapper">
<xsl:param name="Text"/>
    <xsl:when test="contains($Text,'/')">
      <xsl:call-template name="text_wrapper">
        <xsl:with-param name="Text" select="substring-after($Text,'/')"/>
      <xsl:value-of select="//node()[@name=$Text]"/>


<?xml version="1.0"?>
<node name="funstuff">
   <node name="jokes">
     <node name="veryfunnyjoke">the joke</node>

<?xml version="1.0" encoding="utf-8"?>the joke




-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Alek Andreev
Sent: Monday, January 28, 2002 2:18 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  FW: Path Reversal


Suppose I have the following piece of XML:

<node name="funstuff">
  <node name="jokes">
    <node name="veryfunnyjoke"/>

I have a path (as a string) which is composed of the @names of the
nodes. It looks like /funstuff/jokes/veryfunnyjoke. How can I write a
template (or an EXSLT function) that returns the node the path points to
(e.g. veryfunnyjoke)?

Alek Andreev

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.