Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [XSLT] How to establish a context node without

From: David Carlisle <david-news@---------.-----.--.-->
To: NULL
Date: 11/18/2008 12:55:00 AM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent