Hi Chris,
You can make your stylesheet miles simpler and shorter by using a
different approach. Instead of tons of parameters, use something
extensible, like an XML structure (why not, it's all xml anyway). You
can then do it the 'xslt way' by defining templates. You code can become
this:
<xsl:param name="key-settings">
<setting name="MASTERCATALOGNAME" value="myvalue" />
<setting name="PRODUCTID" value="myprodid" />
....
</xsl:param>
<xsl:template match="/" >
<DataService>
<Identity>
[...]
</Identity>
<Transaction>
<Command type="Query">
<MasterCatalogRecord etype="Entity">
<ExternalKeys>
<xsl:apply-template select="$key-settings/setting" />
</ExternalKeys>
[...]
</Transaction>
</DataService>
</xsl:template>
<xsl:template match="setting">
<Key name="{(_at_)name}" type="string">
<xsl:value-of select="@value" />
</Key>
</xsl:template>
That's all there is too it. There is no need to add any xsl:if anymore,
as the processor will do the thinking for you. If you don't want to
chain the name of the Key to the name of the Setting, you can choose to
add an external source that contains a lookup table (also in XML) with
all your paramname/keyname mappings. You can get this resource with
doc() or document() function.
If you use XSLT 1, you must use the node-set() extension function.
Cheers!
-- Abel Braaksma
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--