Reading value of STX attribute

Hey experts,

 I have the following xml file:

<ediroot>
  <interchange Standard="EDIFACT" SyntaxId="UNOA" SyntaxVersion="4" Date="20060109" Time="0824" Control="P0677/0070" Priority="A" AckRequest="1">
        <group>
      <transaction Control="0677/0070/0001" DocType="PRICAT">
        <segment Id="BGM">
          <element Id="BGM01">9</element>
   ....etc
     </group>
  </interchange>
</ediroot>

 I want to retrieve the value in the Date attribute of the interchange tag, I did the following:

<stx:template match="ediroot">
        <stx:element  name = "root">
            <stx:process-children group="Ediroot"/>
            <stx:value-of select="$newline"/>
        </stx:element>
  </stx:template>

<stx:group name="Ediroot">
    <stx:template match="interchange">
     <stx:process-attributes group = "dateAttr" />
     <stx:process-children group="Interchange"/>
    </stx:template>
  </stx:group>

Then I didn't know what should I do inside the dateAtr group to read the value in the Date Attribute; I tried the following, but it obviously didn't work:

<stx:group name="dateAttr">
    <stx:assign name="pricatDate" select="interchange[@Date]">
  </stx:group>

any help on what should I do to read the value in the Date attribute??
LVL 3
mte01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Geert BormansInformation ArchitectCommented:
<stx:assign name="pricatDate" select="interchange/@Date">
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mte01Author Commented:
Yes..that worked!!..(with some modifications since I put it at a different node)
0
mte01Author Commented:
Thanks for your help!
0
Geert BormansInformation ArchitectCommented:
you are welcome

note the following
select="interchange[@Date]"
selects the interchange element that has an attribute Date
[] is a predicate, in there you can put restrictions on the node selection before it
if you would like to select an interchange element that has a date attribute with value '2005-11-24'
it would be like this
select="interchange[@Date = '2005-11-24']"

if you are just selecting the attribute, you need a path with a forward slash, like this interchange/@Date

cheers
0
mte01Author Commented:
Yes, I already knew how to find the predicate, and I wanted to know how to find the value of the attribute...thanks for your help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.