If files are lengthy it's best to post them on the saxon-help forum. If you can get it to a compact size (and please try) then include them in the message and post them here.
 
Michael Kay


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of jeff isenhart
Sent: 16 March 2005 17:45
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] avoiding apply-templates duplication

Thanks for you response Michael.

 

>> Perhaps you need to show us more of your code

I do have an input xml and two xsl files. (Trimmed down as much as possible) Should I paste them in a mail or attach them?

 

Thanks,

 

Jeff

 


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Tuesday, March 15, 2005 4:30 PM
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] avoiding apply-templates duplication

 

Doing the apply-templates in a variable is the right thing to do. I don't understand what you mean by saying this "mangles/eliminates the html tags in the output". Perhaps you need to show us more of your code, and perhaps the input and/or output. What are you actually doing with the variable once you've created it? What you need to do is to use xsl:copy-of to copy it to the output (twice).

 

Michael Kay

http://www.saxonica.com/

 

 

 


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of jeff isenhart
Sent: 15 March 2005 21:19
To: saxon-help@lists.sourceforge.net
Subject: [saxon] avoiding apply-templates duplication

Hi all,

 

I am using saxon to output html and I notice that I am applying the same template twice. Normally I have no problem with this, but the apply-templates call in this particular case is expensive for large input data. I am seeking a simple way to make a single template call. I tried (as a hack) using a variable like so:

 

    <xsl:variable name="colsumm">

<xsl:apply-templates select="groupsummary/col" mode="summary">

                        <xsl:with-param name="rowtype" select="’sum1’"/>

            </xsl:apply-templates>

    </xsl:variable>

 

But this (to no surprise) mangles/eliminates the html tags in the output. Any help is appreciated.

 

Jeff

Example xsl:  

 

<xsl:template match="data//group" mode="normal">

 

<!-- do some stuff here -->

<!--  generate attribute information for header -->

 

<!--  build summary columns for header row……… -->

<xsl:apply-templates select="groupsummary/col" mode="summary">

                        <xsl:with-param name="rowtype" select="’sum1’"/>

            </xsl:apply-templates>

 

<!-- do some more stuff here -->

<!--  generate attribute information for summary -->

 

<!--  build summary columns for summary row……… -->

<xsl:apply-templates select="groupsummary/col" mode="summary">

                        <xsl:with-param name="rowtype" select="’sum1’"/>

            </xsl:apply-templates>

 

</xsl:template>