Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: [XSLT] How to establish a context node without [Thread Next] Re: [XSLT] How to establish a context node without 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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
