Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Transformation for XML element node with attribute values

Former Member
0 Likes
1,019

hi Experts,

i have read through many posts and was unable to find something to answer my question.  I have an XML document that I need to transform into a table and while I know how to do that part, the issue is that the XML document has element attributes that I need values from.

This is the one node specifically that I need help with;

<row sco-id="995088131" type="meeting" icon="meeting">

i need the sco-id.  so in my transformation I have 

           <SCO_ID>

                  <xsl:value-of select="sco-id"/>

            </SCO_ID>

that doesnt work so I tried replacing "sco-id" with "row" and I get the entire contents of that elements attribute values without the attribute names.

My question is, how do I handle the transformation so I can read the element and attribute values by specific attribute?

Thanks experts.  I imagine it is something silly but any help would be most appreciated.

Chris

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
787

You can try selecting the attribute by using: select="@sco-id"

@ is used to specify attribute name.

Also try select="row/@sco_id"

3 REPLIES 3
Read only

Former Member
0 Likes
788

You can try selecting the attribute by using: select="@sco-id"

@ is used to specify attribute name.

Also try select="row/@sco_id"

Read only

0 Likes
787

Thank you very much!!  This has saved me much grief!!  I really appreciate everyone's help!!

Read only

Shank1971
Participant
0 Likes
787

Like Manish mentioned you have to use "@" sign to read attribute. For example

/xpath/@sco_id

Regards,

--Ravi