Reading value of STX attribute

Posted on 2006-03-29
Medium Priority
Last Modified: 2013-11-19
Hey experts,

 I have the following xml file:

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

 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:group name="Ediroot">
    <stx:template match="interchange">
     <stx:process-attributes group = "dateAttr" />
     <stx:process-children group="Interchange"/>

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]">

any help on what should I do to read the value in the Date attribute??
Question by:mte01
  • 3
  • 2
LVL 60

Accepted Solution

Geert Bormans earned 1680 total points
ID: 16325556
<stx:assign name="pricatDate" select="interchange/@Date">

Author Comment

ID: 16330640
Yes..that worked!!..(with some modifications since I put it at a different node)

Author Comment

ID: 16330643
Thanks for your help!
LVL 60

Expert Comment

by:Geert Bormans
ID: 16331041
you are welcome

note the following
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


Author Comment

ID: 16331080
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!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question