xsl-list
[Top] [All Lists]

RE: Filtering on attributes

2003-11-20 06:24:23
Hello,

Is it possible to filter the data on attribute value before 
displaying? For example, it displays the data from those 
nodes where 'scope of dessimination' is EFSA. 

Any suggestion?

Just add the Xpath query after the variable containing the XML from the 
document.


Style sheet
-----------

 <xsl:template match="/">
  <xsl:for-each 
select="document('multiple_input1.xml')/someURIs/file">
   <xsl:variable name="copy_current_file" 
select="document(string(.))"/>
   <xsl:value-of select="$copy_current_file"/>
   <br/><br/>
  </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>

<xsl:value-of select="$copy_current_file//category"/>

Will get you all the category-nodes. So all you need to do is construct the 
Xpath to retrieve the nodes with attribute values you need.

For writing Xpaths this guide is a good intro (se the list to the left):
http://www.zvon.org/xxl/XPathTutorial/General/examples.html

Cheers,
Flemming

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>