w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to select unique child nodes of all siblings in XSLT 1

This XSLT stylesheet will produce the desired output. Note that it relies on there being no duplicate Gases element inside a single Content element.

<xsl:stylesheet version="1.0"
  <xsl:output method="text"/>

  <xsl:strip-space elements="*"/>

  <!-- Match Gases elements whose value does not appear in a Gases
element inside a previous
       Content element. -->
  <xsl:template match="//Gases[not(. =
    <xsl:value-of select="."/>
    <xsl:text> </xsl:text>

  <!-- Need to override the built-in template for text nodes, otherwise
they will still get
       printed out. -->
  <xsl:template match="text()"/>


© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.