Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


keys vs templates

From: Andy Chambers <achambers.home@----------.--->
To: NULL
Date: 8/2/2008 1:44:00 PM
Hi,

I'm generating a stylesheet that will transform all instances of

<xref ref="001"/>

in a document into a fragment like

<ul>
  <li>one</li>
  <li>two</li>
</ul>

I see two ways of doing this....

1. Define the expansions in a result tree fragment and use a key to
get fast access to the correct expansion Then a single xref match
template looks up the variable using the key to get the appropriate
expansion

<xsl:key name="xdefs" match="xdef" use="id"/>

<xsl:variable name="expansions">
<expansions>
  <xdef id="001">
     <ul>
       <li>one</li>
      <li>two</li>
    </ul>
  </xdef>
</expansions>
</xsl:variable>

2. Define a match template for each expansion

<xsl:template match="xref[@ref='001']">
  ...
</xsl>

<xsl:template match="xref[@ref='002']">
  ..
</xsl>


Is one of these approaches better in terms of performance than the
other?  Does it make a difference which processor is used?

Cheers,
Andy


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