Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Hoi Wong" <wonghoi@--------.--->
To: NULL
Date: 11/20/2008 5:17:00 PM
"David Carlisle" <david-news@d...> wrote in message 
news:MnoUk.83905$s62.13489@n......
> 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

Thanks for the hint.

Unfortunately, the software that I'm using (namely MATLAB and the orphaned 
proprietary data converter from the vendor) only support XSLT 1.0.

In fact, I was using the variables trick before hitting this forum so I'll 
stick to that because it's easier to debug than switching nodes.

Cheers,
Hoi 




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