Here's a snippet of the xml in question:
Code:
<FACILITY_RELATED>
  <PES_ID>384</PES_ID> 
  <ES_ID>402</ES_ID> 
  <RELATED_CODE>H</RELATED_CODE> 
  <AUTO_RELATED>false</AUTO_RELATED> 
  <PESRelatedFacilityNumber>1039</PESRelatedFacilityNumber> 
  <PESRelatedFacilityTypeCode>IHB</PESRelatedFacilityTypeCode> 
  <ESRelatedFacilityNumber>1010</ESRelatedFacilityNumber> 
  <ESRelatedFacilityTypeCode>AGM</ESRelatedFacilityTypeCode> 
</FACILITY_RELATED>
<FACILITY_RELATED>
  <PES_ID>384</PES_ID> 
  <ES_ID>401</ES_ID> 
  <RELATED_CODE>Q</RELATED_CODE> 
  <AUTO_RELATED>false</AUTO_RELATED> 
  <PESRelatedFacilityNumber>1038</PESRelatedFacilityNumber> 
  <PESRelatedFacilityTypeCode>IHB</PESRelatedFacilityTypeCode> 
  <ESRelatedFacilityNumber>1010</ESRelatedFacilityNumber> 
  <ESRelatedFacilityTypeCode>AGM</ESRelatedFacilityTypeCode> 
</FACILITY_RELATED>
All these FACILITY_RELATED nodes are records from a dataset. What I need to do is determine if a given pes_id is present, and if so, then do something. I don't have to aquire the node or even know how many nodes are present - just know if it's there.

But how do I do this in an xsl:if? I basically want to be able to say <xsl:if test="if there's a pes_id = 5 somewhere in the facility_related nodes, then do something" />

I thought I would have the test in an xml:template - something like:
Code:
    <xsl:template name ='IsIDPresent'><xsl:param name='ID' />
        <xsl:for-each select ='//FACILITY_RELATED'>
            <xsl:if test ='PES_ID = $ID'>
                <xsl:value-of select ='PES_ID'/>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
But I couldn't figure out how to put the call to the template into the xsl:if test.

Are there other ways to do what I'm trying to do? Any help would be appreciated.