I have a situation using the document function which may be a bug (or I'm doing something incorrectly).
 
I have two XSLT stylesheets, a.xsl, and b.xsl. b.xsl imports a.xsl (snippets below), and b.xsl has data elements using a separate namespace, which a.xsl needs to access, using the document('') function to get the current document.
 
The <xsl:for-each> syntax below works, but the <xsl:value-of> doesn't, even when using the exact same XPath and predicate. I got around this by using "document('b.xsl')" to make both work. I have the following questions:
 
A) Is there a valid reason why for-each works and value-of doesn't?
B) Is there any loss in performance efficiency, using the "document('b.xsl')" instead of "document('')?
 
Thanks,
 
Cory
 
a.xsl:
 
<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:fw="http://www.compuflex.com/framework/2.0"
 xmlns:csd="http://www.compuflex.com/framework/componentStateDefs"
 version="1.0"
 exclude-result-prefixes="fw csd">
  <xsl:output method="html" indent="yes"/>
...
<xsl:template name="processData">
  <xsl:for-each select="document('')/xsl:stylesheet/csd:data/csd:dataElement">
   ... some code
  </xsl:for-each>
</xsl:template>
 
<xsl:template name="processElement">
  ...
  <xsl:value-of select="document('')/xsl:stylesheet/csd:data/csd:dataElement[name='test']/@name"/>
</xsl:template
 
b.xsl:
 
<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:fw="http://www.compuflex.com/framework/2.0"
 xmlns:csd="http://www.compuflex.com/framework/componentStateDefs"
 version="1.0"
 exclude-result-prefixes="fw csd">
  <xsl:import href="a.xsl"/>
  ...
 
<csd:data>
  <csd:dataElement name="test"/>
  <csd:dataElement name="test2"/>
</csd:data>
 
Cory Isaacson
President & CTO
Compuflex International
(818) 884-1168
[EMAIL PROTECTED]
www.compuflex.com
 

Reply via email to