1 <?xml version="1.0" encoding="ISO-8859-1"?>
   2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   3     
   4     <xsl:output method="xml" indent="yes"/>
   5     
   6     <xsl:variable name="ids" select="//ids//id"/>
   7     <xsl:variable name="dummy" select="document('Bug6206491_2.xml')"/>
   8     
   9     <xsl:template match="/"> 
  10         <test1><xsl:apply-templates select="$ids"/></test1>
  11         <test2><xsl:apply-templates select="$dummy//ids/id"/></test2>
  12     </xsl:template>
  13     
  14     <xsl:template match="id">
  15         <xsl:variable name="entity" select="id(@value)"/> 
  16         <must-be-one><xsl:value-of select="count($entity)"/></must-be-one>
  17     </xsl:template>
  18     
  19 </xsl:stylesheet>