xsl-list
[Top] [All Lists]

Re: [xsl] How to tell the parser it's not a string but a 'path' to a node?

2010-03-16 17:02:05
Dear Jacobus,

Please have a look at http://www.saxonica.com/documentation/extensions/functions/evaluate.html for dynamically evaluating a string as an XPath expression.

Gerrit


On 16.03.2010 22:52, Jacobus Reyneke wrote:
Good day,

I've just spent 5 hours on this and still can't find a solution.

I have an element called glossary. It contains a link to a different
part of the XML file. If I select the path from it, Saxon assumes that
I'm now working with a string value, but I'm not. How to I tell it not
to treat it as a string but to get the value of the node that the
'string' is pointing to?

----This doesn't work ----
(it outputs the path and not the value of the node where the path is pointing )

    </xsl:template>   <xsl:template match="glossary">
       <xsl:variable name="location" select="'/gset/d/'"/>
       <xsl:variable name="path" select="."/>  <!-- Test data contains
gset/goal/description -->
       <xsl:variable name="fullpath" select="concat($location,$path)"/>
..
             <xsl:value-of select="$fullpath"/>
..
     </xsl:template>

----If I "hard code" the value, it works:----
(now I ignore the variables and hardcode a sample path)

    </xsl:template>   <xsl:template match="glossary">
       <xsl:variable name="location" select="'/gset/d/'"/>
       <xsl:variable name="path" select="."/>
       <xsl:variable name="fullpath" select="concat($location,$path)"/>
..
             <xsl:value-of select="/gset/d/gset/goal/description"/>
..
     </xsl:template>

I'm off to bed to cry myself to sleep!

Kind regards,
Jacobus

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit(_dot_)imsieke(_at_)le-tex(_dot_)de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>