Nope. Here is what I belive the problem to be.
My template call is using an Extension Function to return a snippet of
XML.
Is this causing the processor to get confused about what data type is
returned?
Do I need to convert the String representation of the XML to a NodeSet
(not
sure how this is done).
Here's a better, more complete, example of what I'm trying to do . . .
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:vocabUtil="gov.cdc.pdp.vocabulary.VocabUtility"
exclude-result-prefixes="xalan">
<xsl:template match="/">
<out>
<xsl:variable name="var1">
<docelem>
<elem1>
<elem1a>ELEMENT1A</elem1a>
<elem1b>,ELEMENT1B</elem1b>
</elem1>
<elem2>
<elem2a>ELEMENT2A</elem2a>
</elem2>
</docelem>
</xsl:variable>
<xsl:variable name="var2">
<xsl:call-template name="myTemplateCall">
<xsl:with-param name="arg1" select="'arg1value'"/>
</xsl:call-template>
</xsl:variable>
<!-- OUT HERE IS WHAT IS EXPECTED -->
<xsl:for-each select="xalan:nodeset($var1)/docelem//*">
<xsl:value-of select="name(.)"/>
<xsl:text>,</xsl:text>
</xsl:for-each>
<!-- OUTPUT HERE DOES NOT HAPPEN .... UGHHHH -->
<xsl:comment><xsl:value-of select="$var2"/></xsl:comment>
<xsl:for-each select="xalan:nodeset($var2)/vvResult//*">
<xsl:value-of select="name(.)"/>
<xsl:text>,</xsl:text>
</xsl:for-each>
</out>
</xsl:template>
<xsl:template name="myTemplateCall">
<xsl:param name="arg1"/>
<xsl:value-of select="vocabUtil:validateCode($arg1)"/>
<!-- This extension function returns this XML snippet -->
<!-- <vvResult> -->
<!-- <element1>some value</element1> -->
<!-- <element2>some value</element2> -->
<!-- </vvResult> -->
</xsl:template>
</xsl:stylesheet>
-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: Thursday, September 15, 2005 2:14 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Tree Fragment versus Node Set
Perhaps your elements are actually namespaced? Just a thought.
Try <xsl:message><xsl:copy-of select="$myVar"/></xsl:message>
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Kevin L. Cobb [mailto:kevin(_dot_)cobb(_at_)emergint(_dot_)com]
Sent: 15 September 2005 17:43
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Tree Fragment versus Node Set
Now I have a problem getting values out of my node-set which was
converted from the tree fragment.
<xsl:variable name="myVar">
<xsl:call-template name="buildMyVariableNode">
<xsl:with-param name="arg1" select="'test1'"/>
<xsl:with-param name="arg2" select="'test2'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of
select="xalan:nodeset($myVar)/result/firstElement/text()"/>
I get nothing back for the value-of tag. My XML snippet that is the
nodeset would look something like this:
<result>
<firstElement>some value</firstElement>
<secondtElement>some value</secondElement>
</result>
I've tried variations on the XPATH expression but nothing is working.
This simply
ouput of the nodeset works as expected.
<xsl:value-of select="$myVar"/>
And also ...
<xsl:value-of select="xalan:nodeset($myVar)"/>
I know I must be missing something simple but I can't seem to see if
for the trees.
-Kevin
-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: Thursday, September 15, 2005 12:15 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Tree Fragment versus Node Set
is there a
better way to do this?
No, in 1.0 there isn't. You sometimes need to create result tree
fragments.
But don't do it when you don't need to.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Kevin L. Cobb [mailto:kevin(_dot_)cobb(_at_)emergint(_dot_)com]
Sent: 15 September 2005 15:33
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Tree Fragment versus Node Set
I realize that its always better to form my variables into
node-sets
versus tree fragments by using the select attribute
whenever possible.
But, can one ALWAYS prevent (in XSLT 1.0) making a tree
fragment? For
example, if building my variable comes from a template
call, is there
a better way to do this?
<xsl:variable name="myVar">
<xsl:call-template name="buildMyVariableNode">
<xsl:with-param name="arg1" select="'test1'"/>
<xsl:with-param name="arg2" select="'test2'"/>
</xsl:call-template>
</xsl:variable>
-Thanks,
Kevin
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--