XSLT & The Noob........

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BobSSC
    New Member
    • Apr 2009
    • 4

    #1

    XSLT & The Noob........

    Folks -

    I have a stylesheet difficulty that I'm sure most of you could probably solve in moments - this thing has had me stymied for parts of several days......I've attached the stylesheet and some sample data.

    The stylesheet is by no means pretty, but it's supposed to output HTML for the body of an email. There are Header and OrderResponseBo dy children to the OrderResponse parent(CIDX). The problem is that I need to pull a date out of the XML in the Header nodeset while processing the OrderResponseBo dy nodeset. The closest I've been able to come to suceeding is by using 'following-sibling' although what I really need is something like a 'following-sibling-or-self'.

    The stylesheet has some comments, I'm dealing with 'Date Acknowledged' and no amount of blood, sweat and tears has helped me find a solution to this particular problem! I had posted on another forum but I guess they're all on vacation!

    Thanks For Helping Out!

    Bob
    Attached Files
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I see only one date in the header section so you can access that (more or less) directly.
    you can also "save" the date in <xsl:variable > for later usage.

    Comment

    • BobSSC
      New Member
      • Apr 2009
      • 4

      #3
      Hi Dormilich -

      The CIDX standard allows for 2 date fields in the Header:
      Header 1..1
      ThisDocumentIde ntifier 1..1
      ThisDocumentDat eTime 1..1
      RequestingDocum entIdentifier 0..1
      RequestingDocum entDateTime 0..1
      From 1..1
      To 1..1

      I need both anyway.

      The stylesheet is using
      <xsl:for-each select="./OrderResponseBo dy"> which seems to be preventing me from puilling in the date/time elements from the header.

      I've tried selecting Header/RequestingDocum entDateTime/DateTime/text()) and that returns nothing. I've also tried preceeding-sibling and that returns the same date for all 3 orders in the sample data. As you can see from the XSLT, I'm stuck using version 1.0 and I'm forced to use a really ugly conversion from 'Zulu' time as well. So far, the only thing that has gotten me even close is the following-sibling currently in the XSLT but that returns 2 of the 3 dates.

      Bob

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        is there any clear identification which header belongs to which body, except that the header precedes the body in the xml?

        Comment

        • BobSSC
          New Member
          • Apr 2009
          • 4

          #5
          None whatsoever - this is strictly a matter of order/precedence:

          Header
          ResponseBody
          Header
          ResponseBody
          Header
          ResponseBody

          Comment

          • jkmyoung
            Recognized Expert Top Contributor
            • Mar 2006
            • 2057

            #6
            preceding-sibling::Header[1]/restofxpath...

            ?

            Comment

            • BobSSC
              New Member
              • Apr 2009
              • 4

              #7
              Thanks JKM -
              I got it working this afternoon by changing the XSLT to instantiate based on Header and changing the pathing to select following sibling nodes. I do appreciate the help!

              Bob

              Comment

              Working...