xml - xsl:for-each test a wildcard element -


i trying loop through xml until find element contains string of text.

take simple xml example.

<document>   <item>    <thing1>fee</thing1>    <thing2>fi</thing2>    <thing3>fo</thing3>    <some blah="thingy">fum</some>    <another>i smell</another>    <other>someone</other>   </item> </document> 

i want able search through element/s contains "thing", have seen done before attribute so...

<xsl:for-each test="contains(@blah,'thingy')"></xsl:for-each> 

but want search "thing1, thing2, thing3" , obtain <xsl:value-of select"." /> fee, fi, , fo. need exclude other elements aren't going contain string "thing"

try:

<xsl:for-each select="*[contains(name(), 'thing')]"> 

or, better fit given example:

<xsl:for-each select="*[starts-with(name(), 'thing')]"> 

both called context of item.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo