Re: [xsl] XML Update HOW TO?

Subject: Re: [xsl] XML Update HOW TO?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 13 Jan 2001 09:03:59 +0000
Hi Cristóbal,

>            <xsl:variable name="W">
>                   <xsl:value-of
> select="concat('Paginas/Pagina[@Tipo='New']/','')" />
>                   <xsl:value-of select="concat('texto','')" />
>                   <xsl:text>[@ID='Etiqueta12']</xsl:text>
>            </xsl:variable>
>
> but my problem is that <xsl:value-of select="$W" /> return the string
> Paginas/Pagina[@Tipo=]/texto[@ID='Etiqueta12'] not the node-set

You're getting that problem because you're concatenating lots of text
togther rather than building the node set :)

What you want to do is find the Pagina with @Tipo = 'New', then find
within that the 'texto' element that has an @ID equal to 'Equita12'.
In fact, the string that you constructed is almost the XPath that you
need:

  /Paginas/Pagina[@Tipo='New']/texto[@ID='Etiqueta12']

Note the '/' at the beginning - that says "go back to the root node
and navigate from there".  Without that '/', you'd be looking for
'Paginas' children of the *current node*, which isn't what you want.
  
So to set the variable 'W' to this node set (all the textto elements
with @ID equal to 'Etiqueta12'), use:

  <xsl:variable name="W"
                select="/Paginas/Pagina[@Tipo='New']/texto[@ID='Etiqueta12']" />

I hope that helps you get over this hurdle,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread