• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: XMLNextSibling is there an easier way
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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
echo email@hidden@nl | tr a-z@. p-za-o.@

Sent from my SE/30

 _______________________________________________
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

  • Follow-Ups:
    • Re: XMLNextSibling is there an easier way
      • From: Jim Skibbie <email@hidden>
References: 
 >XMLNextSibling is there an easier way (From: Jim Skibbie <email@hidden>)

  • Prev by Date: Re: View Options
  • Next by Date: Re: View Options
  • Previous by thread: XMLNextSibling is there an easier way
  • Next by thread: Re: XMLNextSibling is there an easier way
  • Index(es):
    • Date
    • Thread