Hoi Wong wrote:
> Instead of specifying document('rpt_pat.xml') every time using absolute
> paths,
as others have said you can't change the current node without for-each
or apply-templates, etc, however you could use a variable
<xsl:variable name="rpt" select="document('rpt_pat.xml')"/>
then you can use $rpt///parameter[@name='PatientBirthYear']
In xslt2 I'd do
<xsl:variable name="rpt" select="document('rpt_pat.xml')"/>
<xsl:key name="rpt" match="parameter" use="@name"/>
then
<xsl:template name="patientData">
<birthyear>
<xsl:value-of select="key('rpt','PatientBirthYear',$rpt)"/>
</birthyear>
<gender>
<xsl:value-of select="key('rpt','PatientGender',$rpt)"/>
</gender>
</xsl:template>
The third argument of key doesn't exactly change the current node but it
changes the effective node used for determing the key lookup, which has
more or less the same effect here.
David
--
http://dpcarlisle.blogspot.com