Subject:Some node navigation help please Author:Ian Shuler Date:20 Jun 2005 11:30 AM
Hi folks...
I keep getting confused when I am navigating an XML doc for either an xsl:template declaration or when using xsl:for-each select="".
For example, I have a document with this structure:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance">
<soapenv:Body>
<getResponse xmlns="">
<result>
<deletedRecords>
<deletedDate>2004-07-07T17:07:20.000Z</deletedDate>
<id>00130000002K9RrAAK</id>
</deletedRecords>
<deletedRecords>
<deletedDate>2004-07-07T17:07:21.000Z</deletedDate>
<id>00130000002K9RsAAK</id>
</deletedRecords>
</result>
</getResponse>
</soapenv:Body>
</soapenv:Envelope>
In a simple transform, I have been declaring in my stylesheet <xsl:template match-"/"> to apply this to the whole xml doc.
Here is where I keep getting confused. I want to just select the <id> element values write them out to an xml like:
Subject:Some node navigation help please Author:Ian Shuler Date:20 Jun 2005 01:50 PM
OK...tried that, still no go...I included the soapenv namespace and did a literal path to the <id> element in my xsl. At that point I should be able to use <xsl:value-of select="." /> to place the <id> element value into the <Id> tags.
Subject:Some node navigation help please Author:(Deleted User) Date:20 Jun 2005 02:09 PM
you didn't take care of the default namespace in your <getDeletedResponse> element. the right xpath should be:
soapenv:Envelope/soapenv:Body/a:getDeletedResponse/a:result/a:deletedRecords/a:id
and declare 'a' as namespace urn:foo.soap.bar.com in your stylesheet.