Re: XMLNextSibling is there an easier way
Re: XMLNextSibling is there an easier way
- Subject: Re: XMLNextSibling is there an easier way
- From: Philip Aker <email@hidden>
- Date: Wed, 30 Apr 2008 13:43:50 -0700
On 08-04-30, at 10:33, Jim Skibbie wrote: I have an XML file that has multiple repeating <ROW> tags. I’m parsing it using the AppleScript XMLLib OSAX and need to find the text of the Value element in the Row element where the value of the IDNoSetItemParent is 6353368.
I’m using the commands: set theDoc to XMLOpen XMLfile set the_root to XMLRoot theDoc set CustomFieldPath to XMLXPath the_root with "ROW/IDNoSetItemParent[. = \"6353368\"]" Which gets me to here: <IDNoSetItemParent>6353368</IDNoSetItemParent> I need to get the text of the Value element that is three siblings below that, so I’m looping the command: repeat with i from 1 to 3 set CustomFieldPath to XMLNextSibling CustomFieldPath end repeat set setValue to (XMLGetText item 1 of CustomFieldPath) Does anyone know if there is a simpler XMLXPath command that works with XMLLib to go down three siblings from the first ? I tried following-sibling, but that does not yield an XMLRef
I'm guessing what you need is "first Value after matched IDNoSetItemParent":
<?xml version="1.0"?> <xsl:output method="text"/> <xsl:template match="//ROW"> <xsl:value-of select="IDNoSetItemParent[.='6353368']/following-sibling::Value[position()=1]"/> </xsl:template> </xsl:stylesheet>
Philip Aker
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden