Posted By

mikander on 07/28/09


Tagged

xslt selection or using condition element-attribute


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

gelogenic
Tyster


Print all XML elements, where given attribute has certain value


 / Published in: XML
 

Extract all elements (and sub nodes), where the attribute 'id' has one of a number of given values

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xsl:stylesheet version="1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4.  
  5. <xsl:template match="linCorpus/text/body/div[@id='d923' or @id='d1168' or @id='d1748']">
  6. <xsl:copy-of select="." />
  7. </xsl:template>
  8.  
  9. <xsl:template match="text()">
  10. </xsl:template>
  11.  
  12. </xsl:stylesheet>

Report this snippet  

You need to login to post a comment.