Subject:Calling 2 XSLT from the main XSLT Author:Michael Kwee Date:20 Dec 2006 01:15 AM Originally Posted: 20 Dec 2006 01:10 AM
Hi there,
We have a main XSLT that calls 2 XSLT. The first XSLT is to map the elements/attributes in the "source" XML to the "target" XML. The second XSLT is to translate elements/attributes starting with "LOV_" in the "target" XML to other values by looking up the corresponding values in a "reference" XML.
The resulting XML should have the attributes LOV_Back_Office_Region__IntObjectFormat converted from "US_AR" to "AR" and LOV_Back_Office_Region__IntObjectName from "US_CO" to "CO".
We use "template match" to do this but it was not matching the nodes starting with "LOV_".
Please advise how can we match the "LOV_" in the second XSLT.
Subject:Calling 2 XSLT from the main XSLT Author:Michael Kwee Date:20 Dec 2006 05:22 PM
Yes, i have tried template match *[starts-with(name(),'LOV_')] but it is still not matching those elements that start with 'LOV_'.
I set the debugging on. When it reaches the step "<xsl:template name="lov_lookup" match="*[starts-with(name(),'LOV_')]">" in test_lov9.xls, it shows that name() contains a value of "#document".
Not sure what does this mean but i am sure it's not getting the output of INT.xls and parse it in test_lov9.xls.
Subject:Calling 2 XSLT from the main XSLT Author:Minollo I. Date:20 Dec 2006 05:35 PM
If you keep your call unchanged in the root template to:
<xsl:call-template name="lov_lookup"/>
...you are going to explicitly execute the lov_lookup template just when the context is the root document (that's what you see in name()). You should change that to something like:
<xsl:apply-templates/>
...to give a chanve to the XSLT engine to actually match templates against the elements in the source document.