xsl-list
[Top] [All Lists]

Re: [xsl] Problem with iterating through a sequence of integers

2008-04-28 14:39:58
On Mon, Apr 28, 2008 at 1:20 PM, Costello, Roger L. 
<costello(_at_)mitre(_dot_)org> wrote:
Hi Folks,

Consider this for-loop which iterates through a sequence.  If the
sequence value is a node then apply-templates is called.  Otherwise,
the value is output:

   <xsl:for-each select="(1, 2, 3)">
       <xsl:choose>
           <xsl:when test=". instance of node()">
               <xsl:apply-templates select="." />
           </xsl:when>
           <xsl:otherwise>
               <xsl:value-of select="."/>
           </xsl:otherwise>
       </xsl:choose>
   </xsl:for-each>

When I run Saxon, I get this error message:


Error: Required item type of @select attribute of xsl:apply-templates
is node(); supplied value has item type xs:integer
Failed to compile stylesheet. 1 error detected.
 .    .   .   .   .   .   .   .    .    .
I'm baffled.  Any ideas?

This situation is perfectly clear, and the XSLT processor does the
right thing -- it actually prompts the author of the code that some
never-to-be-reached, therefore useless and confusing code, should be
removed.


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play




/Roger

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>