A
Andy Chambers
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
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