[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] xslt and xpath troubles


Subject: RE: [xsl] xslt and xpath troubles
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 18 Jun 2003 15:02:52 +0300

Hi,

> in my xml document its possible to reference the content of particular
> element elsewhere in the xml document.
> for example:
> 
> <element1 id="id1">something....</element1>
> ......
> <elementX><get xlink:href="//*[id='id1']"/></elementX>
> 
> is it possible in the xslt to resolve this xpath expression 
> and to include
> the referenced element?
> 
> i tried the following, but all i get is the "//*[id='id1']" 
> (as a string)
> 
> <xsl:template match="get">
>   <xsl:value-of select="@xlink:href"/>
> </xsl:template>

See the archives (and probably the FAQ, too) for and answer why you can't do that in XSLT. Use evaluate() extension found in some engines. If the expression is always in the form

  //*[id=someid]

then change the xlink:href attribute to only contain the id, i.e. "id1" in the example above and use

  <xsl:value-of select="//*[id = current()/@xlink:href]"/>

Cheers,

Jarno - Front Line Assembly: Plasticity

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



Current Thread
Keywords