I am having a problem with RTFs that I don't understand and was 
wondering if someone can confirm or deny that it is a bug (in D10 at least).
  I can't get to any of the nodes in a RTF using xsl:value-of, but I can 
using apply-templates. In the following example, I set a variable with 
the fragment rooted at either 'group1' or 'group2'.  At a later point, I 
want to get a subnode of the fragment, so I convert the RTF into a 
nodeset and reference the subnode like this:

<xsl:value-of select="xalan:nodeset($group)/data"/>

but I get nothing.  Is this legal XSLT?  If I apply-templates on 
xalan:nodeset($group), the subnodes are processed, so I know it is there.

Is it a bug?

Here is the example:
XML:
<doc>
   <group1>
      <data>foo</data>
   </group1>
   <group2>
      <data>bar</data>
   </group2>
</doc>

XSL:
<xsl:stylesheet version="1.0"
   xmlns:xalan="http://xml.apache.org/xalan";
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

   <xsl:output method="xml" encoding="iso-8859-1" indent="yes"/>

   <xsl:variable name="group">
      <xsl:choose>
         <xsl:when test="/doc/group1">
            <xsl:value-of select="/doc/group1"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="/doc/group2"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:variable>

   <xsl:template match="doc">
      The data is:
      <xsl:value-of select="xalan:nodeset($group)/data"/>
      Apply templates gives:
      <xsl:apply-templates select="xalan:nodeset($group)"/>
   </xsl:template>

</xsl:stylesheet>


OUTPUT:
<?xml version="1.0" encoding="iso-8859-1"?>

      The data is:
     
      Apply templates gives:
     
      foo
  




Reply via email to