Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Specify an element in a nodeset directly

From: "roy axenov" <r_axenov@----.-->
To: NULL
Date: 10/8/2006 6:07:00 AM


eric.goforth@g... wrote:
> roy axenov wrote:
> > So what does it do?
> >
> > $rates/rate selects a nodeset of <rate> nodes. The
> > predicate [position()=thingcode] filters this nodeset,
> > dropping all the nodes that don't have a <thingcode>
> > child with content that is equal to the position of the
> > <rate> node in the $rates/rate nodeset. Since there are
> > no <rate> nodes with <thingcode> children in your
> > document, the resulting nodeset is, naturally, empty. I
> > already explained the solution in my previous reply.
>
> I played around with your example, but it doesn't seem to
> work when I have multiple xyzzy elements, for example:
>
> <foo>
>   <bar>
>     <xyzzy>
>       <int>3</int>
>     </xyzzy>
>     <xyzzy>
>       <int>4</int>
>     </xyzzy>
>     <xyzzy>
>       <int>5</int>
>     </xyzzy>
>   </bar>
>   <nodeset>
>     <node>
>       <str>wrong (1)</str>
>       <int>3</int>
>     </node>
>     <node>
>       <str>wrong (2)</str>
>       <int>2</int>
>     </node>
>     <node>
>       <str>right (3)</str>
>       <int>1</int>
>     </node>
>   </nodeset>
> </foo>

It *is* working. I'm not sure what the hell you were trying
to do with the input file like this, though.

Pray tell me, what did you expect as a result? It is
supposed to look up the nth <node> in the document for each
<xyzzy>, where n is the value of an <int> child of <xyzzy>
in question. Since there are only *three* <node>s in the
document, naturally, <xyzzy>'s with <int> of 4 and 5 don't
return bloody anything.

> I'm wondering if it's not possible to do what I'm trying
> to do.

It's been explained no less than three times in this thread
that what you're trying to do is possible, that your
problem lies in messed-up contexts, that to get the context
of the current node you need to use the current() XPath
function. If you're still unable to grasp that, I recommend
hiring yourself an XSLT expert. Seriously, that'll save you
an awful lot of trouble, time and money.

-- 
roy axenov



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent