Divo's answer is a good one.
However, it restricts any eventual filtering to specifying a child's name and value.
It is good to know that one can pass a (what amounts to a) function as a parameter. This very powerful concept is implemented in FXSL -- the Functional Programming Library for XSLT. FXSL is written entirely in XSLT itself.
Here is an appropriate example using the filter function/template. We are passing the filter as a parameter to a template that performs the filtering. The filter can be any code/logic. In this particular case we are passing as parameter a reference to a template that checks if a number is even. The complete transformation outputs only those "num" elements, whose value is an even number.
We could very easily pass any other filter, using exactly the same technique: to filter (un)even numbers, squares, prime numbers, ... etc.
Do note, that one doesn't have to write himself the "filter" template -- it is written once and forever and provided by the FXSL library. As result you typically just uses the <xsl:import/> directive to import the "filter" template and many other useful functions/templates already provided by FXSL.
The transformation below:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:f="http://fxsl.sf.net/"
xmlns:myIsEven="myIsEven"
>
<xsl:import href="filter.xsl"/>
<!-- To be applied on numList.xml -->
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<myIsEven:myIsEven/>
<xsl:template match="/">
<xsl:variable name="vIsEven"
select="document('')/*/myIsEven:*[1]"/>
Filtering by IsEven:
<xsl:call-template name="_filter">
<xsl:with-param name="pList" select="/*/*"/>
<xsl:with-param name="pController" select="$vIsEven"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="myIsEven" mode="f:FXSL"
match="myIsEven:*">
<xsl:param name="arg1"/>
<xsl:if test="$arg1 mod 2 = 0">1</xsl:if>
</xsl:template>
</xsl:stylesheet>
when applied on this source XML document:
<nums>
<num>01</num>
<num>02</num>
<num>03</num>
<num>04</num>
<num>05</num>
<num>06</num>
<num>07</num>
<num>08</num>
<num>09</num>
<num>10</num>
</nums>
produces the desired (filtered) result, containing only the nodes with even values:
Filtering by IsEven:
<num>02</num>
<num>04</num>
<num>06</num>
<num>08</num>
<num>10</num>
More information about Functional Programming in XSLT can be found on the page of FXSL and the library itself can be downloaded from its sourceforce project.
To return to the concrete problem:
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:f="http://fxsl.sf.net/"
xmlns:myFilter="myFilter"
>
<xsl:import href="filter.xsl"/>
<!-- To be applied on Orders.xml -->
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<myFilter:myFilter/>
<xsl:template match="/">
<xsl:variable name="vFilter"
select="document('')/*/myFilter:*[1]"/>
Filtering by PRICE < 15:
<xsl:call-template name="_filter">
<xsl:with-param name="pList" select="/*/*"/>
<xsl:with-param name="pController" select="$vFilter"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="myFilter" mode="f:FXSL"
match="myFilter:*">
<xsl:param name="arg1"/>
<xsl:if test="$arg1/PRICE < 15">1</xsl:if>
</xsl:template>
</xsl:stylesheet>
when applied on this source XML document:
<ORDERS>
<ORDER>
<PRICE>10</PRICE>
</ORDER>
<ORDER>
<PRICE>7</PRICE>
</ORDER>
<ORDER>
<PRICE>22</PRICE>
</ORDER>
<ORDER>
<PRICE>16</PRICE>
</ORDER>
<ORDER>
<PRICE>13</PRICE>
</ORDER>
<ORDER>
<PRICE>19</PRICE>
</ORDER>
</ORDERS>
produces the wanted result:
Filtering by PRICE < 15:
<ORDER>
<PRICE>10</PRICE>
</ORDER>
<ORDER>
<PRICE>7</PRICE>
</ORDER>
<ORDER>
<PRICE>13</PRICE>
</ORDER>