I have question regarding which stylesheet will be the faster performing one.
The input document is a XML document with thousands of lines.
The transformation that I'm running contains a lookup table in the following format:
Code:
<xsl:variable name="lobNamespaces">
<LOBTable>
<LOBs>
<LOB LOBCode="URI1">
<Namespace>http://uri1.com</Namespace>
<NamespacePrefix>uri1</NamespacePrefix>
<Description>text1</Description>
</LOB>
<LOB LOBCode="URI2">
<Namespace>http://uri2.com</Namespace>
<NamespacePrefix>uri2</NamespacePrefix>
<Description>text2</Description>
</LOB>
....
....
(more LOBS)
</LOBs>
</LOBTable>
</xsl:variable>
This is a recursive transformation that looks at each element node in the incoming document. Some of the nodes contain an attribute @NSTag. The transformation finds this NSTag and then applies a certain template based on the value of that NSTag attribute. I have 2 ways of doing it, one with explicit pathing on the lookup table and one using a key structure. Obviously this is only a fraction of the code, but i think it provide the right idea. We are running in a saxon enviroment on a service bus. Which one would be the faster implementaion performance wise? I have a feeling the key valued transformation is the better perfomer.
Transformation Template 1 (Explicit Pathing)
Code:
...
<xsl:apply-templates select=".">
<xsl:with-param name="PF" select="$lobNamespaces/LOBTable/LOBs/LOB[@LOBCode = current()/@NSTag]/NamespacePrefix"/>
<xsl:with-param name="NS" select="$lobNamespaces/LOBTable/LOBs/LOB[@LOBCode = current()/@NSTag]/Namespace"/>
</xsl:apply-templates>
Transformation Template 2 (Keyed Values)
Code:
<xsl:key name="LOBKey" match="LOBTable/*/LOB" use="@LOBCode"/>
...
...
<xsl:apply-templates select=".">
<xsl:with-param name="PF" select="$lobNamespaces/key('LOBKey', current()/@NSTag)/NamespacePrefix"/>
<xsl:with-param name="NS" select="$lobNamespaces/key('LOBKey', current()/@NSTag)/Namespace"/>
</xsl:apply-templates>
Thank you and I appreciate your insights!