[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How do I locate the parent of this node?

Subject: Re: How do I locate the parent of this node?
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 16 Oct 2002 20:44:32 +0200
Re:  How do I locate the parent of this node?
simply use ".." or "parent::XMLDataItem".

Regards,

Joerg

steve.l.lake@xxxxxx wrote:
Help, please!

For the XML data structure below I'm trying to use a recursive template to
piece together the 'path' of each XMLDataItem element. Thus for the
XMLDataItem whose @Name is 'POIssuedDate' I want the template to return the
path as '/bat:Batch/PurchaseOrder/OrderHeader'

To do this I need an XPath statement inside the template to locate the
parent node of the current node. I've been using...

//XMLDataItem[child::XMLDataItem/@Name=$currentNode/@Name]

(where $currentNode is the parameter passed into the template). However,
it's not finding that parent node - actually, in this instance it's not
finding anything. Any suggestions?


<XMLData>


  <XMLDataItem
    DataItemType="XMLElement"
    Name="bat:Batch">

    <XMLDataItem
      DataItemType="Attribute"
      Name="BatchID"
      Description="Unique identifier for the batch file"
      Source="Customer"
      MandatoryOptional="M"
      Format="Aplhanumeric(20)"
      ValidationNotes="Must only include characters valid for use in Windows
file names (reserved characters, such as : are invalid)">
    </XMLDataItem>

    <XMLDataItem
      DataItemType="Attribute"
      Name="NoOfEntries"
      Description="The number of purchase orders in the batch file"
      Source="Customer"
      MandatoryOptional="M"
      Format="Numeric"
      ValidationNotes="This must match the number of orders within the batch
file">
    </XMLDataItem>

    <XMLDataItem>
      DataItemType="XMLElement"
      Name="PurchaseOrder"

      <XMLDataItem>
        DataItemType="XMLElement"
        Name="OrderHeader"

        <XMLDataItem
          DataItemType="XMLElement"
          Name="POIssuedDate"
          Description="Date/time of creation of the order by the service
provider"
          Source="Customer"
          MandatoryOptional="M"
          Format="ccyymmddThh:mm:ss"
          ValidationNotes="Must be a valid date/time">
        </XMLDataItem>

        <XMLDataItem
          DataItemType="XMLElement"
          Name="RequestedDeliveryDate"
          Description="Date/time by which the order is required by the
service provider"
          Source="Customer"
          MandatoryOptional="M"
          Format="ccyymmddThh:mm:ss"
          ValidationNotes="Must be a valid date/time, recommended to be at
least 7 days from submission; cannot be date in the past. This date/time is
repeated later in the order and both occurrences must be the same.">
        </XMLDataItem>

        <XMLDataItem>
          DataItemType="XMLElement"
          Name="OrderReference"

          <XMLDataItem>
            DataItemType="XMLElement"
            Name="AccountCode"

            <XMLDataItem>
              DataItemType="XMLElement"
              Name="Reference"

              <XMLDataItem
                DataItemType="XMLElement"
                Name="RefNum"
                Description="Billing account reference"
                Source="Customer"
                MandatoryOptional="M"
                Format="Alphanumeric(20)"
                ValidationNotes="This must match the value supplied on
registration">
              </XMLDataItem>
            </XMLDataItem>
          </XMLDataItem>

          <XMLDataItem>
            DataItemType="XMLElement"
            Name="BuyerRefNum"

            <XMLDataItem>
              DataItemType="XMLElement"
              Name="Reference"

              <XMLDataItem
                DataItemType="XMLElement"
                Name="RefNum"
                Description="The unique identifier number for the end user
order"
                Source="Customer"
                CustomerMandatoryOptional="M"
                Format="Alphanumeric(20)"
                ValidationNotes="">
              </XMLDataItem>

</XMLDataItem>

</XMLDataItem>

</XMLDataItem>

</XMLDataItem>

</XMLDataItem>

</XMLDataItem>

</XMLData>
Steve Lake

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




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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.