[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

Select a specific RSS attribute using SXL

I have an RSS feed that contains this

<abc:artimg height="53">http://www.apple.com/53-a.jpg</abc:artimg>
<abc:artimg height="60">http://www.apple.com/60-a.jpg</abc:artimg>
<abc:artimg height="100">http://www.apple.com/100-a.jpg</abc:artimg>

I want to display only the image URL with height=100, how do I do that?
0
winstein2005
Asked:
winstein2005
  • 2
2 Solutions
 
SteveH_UKCommented:
Make sure the relevant namespaces are defined in the stylesheet, then use this:

<xsl:template match="artimg[@height='100']">
...
</xsl:template>

The square brackets introduce a constraint on matching.  The @height is the height attribute of matched nodes and the ='100' compares the height attribute to 100.

Let me know if you need more help with this.
0
 
Geert BormansInformation ArchitectCommented:
In the templaet of the parent of all these images do
<xsl:copy-of select="abc:artimg[@height = '100']"/>

somewhere in your source XML you will have an attribute like this
xmlns:abc="..." with ... a string value
copy that entire attribute in the xsl:stylesheet element of your XSLT
(that is the declaration of the abc prefixed namespace)

cheers

Geert
0
 
SteveH_UKCommented:
Thanks for the points :)
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now