Subject: Re: [xsl] Question about xsl:apply-imports From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 11 Sep 2009 11:39:54 -0400 |
<xsl:template match="rm:associated/rm:document"> <!-- applying the template in fields.xsl: --> <xsl:apply-imports/> </xsl:template>
I hope this helps, Wendell
Hi all,
xsl:import is pretty awesome, let me say that right off. But it sometimes yields surprising results.
I have a stylesheet called rendereddocument.xsl that imports a number of other stylesheets using the xsl:import instructions:
<xsl:import href="inc/baseline.xsl"/> <xsl:import href="inc/application-tabs.xsl"/> <xsl:import href="inc/fields.xsl"/> <xsl:import href="inc/search-criteria.xsl"/> <xsl:import href="inc/search-fields.xsl"/> <xsl:include href="../../override/xslt/customization.xsl"/>
in fields.xsl, I have a template defined as follows:
<xsl:template match="rm:document"> <xsl:element name="div" namespace="http://www.w3.org/1999/xhtml"> <xsl:attribute name="class"> <xsl:text>document</xsl:text> <xsl:if test="position() mod 2 = 0"> <xsl:text> alt</xsl:text> </xsl:if> </xsl:attribute> <xsl:apply-templates select="rm:fields"/> </xsl:element> </xsl:template>
and in rendereddocument.xsl I have two templates that are defined as follows:
<xsl:template match="rm:document" priority="-0.1"> <rm:content name="rendereddocument.document"> <xsl:apply-templates select="rm:fields"/> </rm:content>
<xsl:apply-templates select="rm:associated"/> </xsl:template>
<xsl:template match="rm:associated" priority="-0.1">
<rm:content name="{concat('rendereddocument.associated.', ../rm:associated/@name)}">
<div class='component collapsible-component collapsed'>
<div class='component-title'>
<h3><a href='#'><xsl:value-of select="@displayName"/></a></h3>
<ul class='component-action-list'>
<li class='active'><a href='#'>Showing relevant</a></li>
<li class='last'><a href='#'>Show all</a></li>
</ul>
</div>
<div class='component-part component-document-list'>
<xsl:apply-imports/>
</div>
</div>
</rm:content>
</xsl:template>
In the last template, there's an xsl:imports instruction. The element on which this template is matching, rm:associated, has rm:document children. It's my understanding that xsl:apply-imports should elect to apply the xsl:template defined in fields.xsl, not in rendereddocument.xsl. However, this isn't what's happening. Instead, the template matching rm:document defined in rendereddocument.xsl is being applied.
Any help would be most appreciated. Let me know if you need to see all the files. Last time, the issue was glaringly apparent from just the first email. ;)
Best regards,
--Bill F.
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Question about xsl:apply-, G. Ken Holman | Thread | [xsl] compare attributes, Szabo, Patrick \(LNG |
Re: [xsl] Question about xsl:apply-, G. Ken Holman | Date | RE: [xsl] Finding first difference , Michael Kay |
Month |