Re: [xsl] <xsl:apply-imports/> with select attribute

Subject: Re: [xsl] <xsl:apply-imports/> with select attribute
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Thu, 19 Dec 2013 14:15:36 +0100
If you are able to modify the imported stylesheets, you could add a name to the template that matches the document node and call these templates in your for-each instruction.

<xsl:template match="/" name="imported1">

On 19.12.2013 13:35, Christian Mahnke wrote:
Hi Micheal,

What would you want this construct to actually do?

My use case is as follows: Ibve got a master template, in which the template @match="/" contains a <xsl:for-each/> over a collection(). Inside the loop I would like to call templates from imported stylesheets, that are designed to handle single documents. Additionally they havenbt be designed to run together with other templates, so they contain no @mode attribute on their template @match="/".

This way the calls to <xsl:apply-templates select=".b/> (where . is a document node from the collection) doesnbt match the root template of the imported stylesheet, but the root template of the master stylesheet, which causes a unwanted loop.

Ibm just looking for a way to be able to give the imported stylesheets a higher priority when Ibm looping to a collection of files.


apply-imports means "process the current node using the template that would have matched if this one didn't". It's hard to see what that could mean when processing a different node, i.e. one that doesn't necessarily match the current template rule.

Michael Kay

On 19 Dec 2013, at 11:07, Christian Mahnke <cmahnke.sub@xxxxxxxxxxxxxx> wrote:

Hi list,
is there a way (in XSLT 2.0) to get a mix of <xsl:apply-templates select="document($file)b/> and <xsl:apply-imports/>? Something like <xsl:apply-imports select="document($file)b/>
This doesnbt seem to be valid but would be very usefulb&

Best, Christian

-- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx,

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard VC6ckler

Current Thread