Print all XML elements, where given attribute has certain value


/ Published in: XML
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.