tags:

views:

54

answers:

2

hey everyone my xml has some node with same attribute and i would like to pull them using some xpath hope you can help so it basically looks like this

<myxml>
 <something Type="AT_SAS_6"/>
 <something Type="AT_SAS_50"/>
 <something Type="AT_SAS_200"/>
</myxml>

i know that if it was on the name i could do something like

<xsl:template match=*[starts-with(name(),  'AT_SAS')]">

is there anyway to do the same to attribute value?

A: 

Preface attribute names with @ and you can use them in your xpath expressions. Just write a template to match to your root node (myxml), loop through all child "something"'s and then pull the attribute with something like this:

<xsl:value-of select="./@Type" />
cakeforcerberus
+2  A: 

I think the XPATH you're looking for is ...

myxml/something[starts-with(@Type, "AT_")]
JP Alioto
great just what I've wanted / needed....
Great! Glad to help!
JP Alioto