[thelist] DOMDocument - was XPATH woes

Chris Hayes chris at londonweb.net
Tue May 11 11:48:13 CDT 2004


Thanks for that.  My head's in a mess.

My problem is with DOMDocument and XPATH.  I should have been more specific.
I'm still on an ASP job I posted about a while back.  I'm really not the
person for the job, but, I am the person on it :(

I have the DOMDocument with the XML loaded
...
<bobtypes>
    <bob id="4"></bob>
    <bob id="7"></bob>
    <bob id="10"></bob>
</bobtypes>
...

to return "4,7,10"

The id values can be any integer within a certain range.  I can happily
retrieve other XML values

Set myVar=xmlDOMDOC.documentelement.selectSingleNode("elroot/abc/xyz")

But I'm having problems with the random id's.  I get an error if I try to
retrieve a bob id that doesn't exist.  I was hoping there was a magic
solution.  I'd need to know more to even make a useful google query.

Any ideas oh wise ones?









----- Original Message ----- 
From: <John.Bedard at ngc.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, May 11, 2004 4:28 PM
Subject: RE: [thelist] XPATH woes


Don't think you can do this with a single statement. However, this should do
it...

<xsl:for-each select="/bobtypes/bob">
<xsl:value-of select="@id"/>
</xsl:for-each>

Also here is a decent quick reference for XPATH (among others) at this site,
downloadable in PDF format: http://www.deepx.com/resources/quickref/

-----Original Message-----
From: Chris Hayes [mailto:chris at londonweb.net]
Sent: Tuesday, May 11, 2004 8:10 AM
To: thelist at lists.evolt.org
Subject: [thelist] XPATH woes


Hi

Looking for plain English help for this issue.  I want to return a list of
all the bob id's in the xml below.

<bobtypes>
    <bob id="1"></bob>
    <bob id="2"></bob>
    <bob id="3"></bob>
</bobtypes>

to return "1,2,3"

Is there any XPATH to do this?  Do you have any really good XPATH links to
teach a novice.

Ta

-- 
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list