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

[xsl] How to construct an XPath expression for this node-set?


Subject: [xsl] How to construct an XPath expression for this node-set?
From: Tim Meals <tmeals@xxxxxxxxx>
Date: Wed, 6 Aug 2003 15:16:27 -0700

I'm working with a problem I'd like to solve with a single XPath
expression.  Yes, this is slightly off-topic, but I've seen some of the
mind-boggling XPath expressions pass through this list and can't figure
out how to do this one myself.

The XML file excerpt is something like this:
...
<Address addressID="100">
    <Name xml:lang="en">90 - Test Name</Name>
    ...
</Address>
...
<Address addressID="100">
    <Name xml:lang="en">91 - Another Name</Name>
    ...
</Address>

By definition, there are more than one Address element per XML file.
Normally, there will be exactly two, but the spec allows the number to
be open-ended.

I would like to receive back a nodeset from the XPath expression, but
concatenating the addressID with the substring-before(Name, ' ').  If I
evaluate:
    concat( //Address/@addressID, '-',
            substring-before( //Address/Name, ' ' ) )
I get back a String with one value ("100-90", in this case).  What I
want is a nodeset containing elements with "100-90", "100-91".  Does
anyone have any ideas on how to procede?  I'm running Xalan 2.4.1, but
could upgrade to 2.5.1 if there is functionality there that's not
present in 2.4.1.

Thanks,
Tim

-- 
e-mail: tmeals@xxxxxxxxx

"Recommend to your children virtue; that alone can make them
 happy, not gold."
    -- Ludwig van Beethoven

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



Current Thread
Keywords