Re: [xslt] [BUG?] xslt:variable to represent some elements issue



On Sunday 21 August 2005 06:26, Christian Parpart wrote:
> On Saturday 20 August 2005 20:26, Mark Vakoc wrote:
> > > This looks really neat, and would be ideal, HOWEVER, I can't qualify
> > > the "result" variable as "$result/Redirect" or whatever would look like
> > > an node access. In fact, the global variable is *not* a string, it's an
> > > element template, exactly as the XSLT specification has declared (I
> > > read it that way at least);
> >
> > No, it's a result tree fragment:
> > http://www.w3.org/TR/xslt#section-Result-Tree-Fragments
> >
> > > So now, is this a bug of libxslt's xpath or XSLT implementation
> > > regarding xsl:variable element templates?
> > >
> > > If not, how do I reach my goal then?
> >
> > libxslt is following the spec correctly.  Use the non-standard
> > exsl:node-set() to convert a result tree fragment to a node-set.

Okay, has been fairly simple (this time ;) but I can't get it completely working :(

<xsl:stylesheet
  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
  xsl:version='1.0'
  xmlns='http://www.w3.org/1999/xhtml'
  xmlns:exsl='http://exslt.org/common'>

  <xsl:variable name='result'>
    <Element attr='value'>content</Element>
  </xsl:variable>

  <xsl:template match='/Page'>
    <div>#1: <xsl:value-of select='exsl:node-set($result)/Element'/>]</div>

    <div>#2: <xsl:value-of select='exsl:node-set($result)'/>]</div>

    <div>#3: <xsl:value-of select='exsl:node-set($result)/Element/@attr'/>]</div>
    <div>#4: <xsl:value-of select='exsl:node-set($result)/@attr'/>]</div>
  </xsl:template>

</xsl:stylesheet>

Well, in my above example, only the <div> number #2 shows me some result ("content").
But neither #1, nor #3 or #4 give me, what I tried to get (they just returned nothing).

Hmm.... what did I wrong?

Many thanks,
Christian Parpart.

-- 
 07:33:16 up 150 days, 20:40,  0 users,  load average: 0.02, 0.02, 0.00

Attachment: pgpQi3tmnriSb.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]