Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 29th, 2009, 03:53 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default Wrong Required Item Type for variable.. ??

I'm using Saxon 9b

I must have a typo somewhere.. but I don't know where.

Here's the code:
Code:
        
        <xsl:variable name="attrSubTree">
            <xsl:for-each select="$ratttable//TL1Attribute">

                <xsl:variable name="attrName">
                    <xsl:value-of select="."/>
                </xsl:variable>

                <ATTR>
                    <xsl:value-of select="$attrName"/>
                </ATTR>

            </xsl:for-each>
        </xsl:variable>

        <xsl:variable name="namedSubTree">
            <NAMEDBLOCK BLOCK="4">
                <xsl:for-each select="$attrSubTree/ATTR">

                    <xsl:variable name="attrName2">
                        <xsl:value-of select="."/>
                    </xsl:variable>

                    <xsl:if test="string-length($attrName2) > 0">
                        <xsl:if test="count($syntaxSubTree//KEYWD[. = $attrName2]) = 0">
                                <KEYWD>
                                    <xsl:value-of select="$attrName2"/>
                                </KEYWD>
                        </xsl:if>
                    </xsl:if>

                </xsl:for-each>
            </NAMEDBLOCK>
        </xsl:variable>
        
        <!--        
            Dump The Named Attribute SubTree
        
        <xsl:text>&#x0a;</xsl:text>
        <xsl:text>Named Keywords</xsl:text>
        <xsl:text>&#x0a;</xsl:text>
        <xsl:for-each select="$namedSubTree/NAMEDBLOCK/KEYWD">
            <xsl:text>Attribute: </xsl:text>
            <xsl:value-of select="."/>
            <xsl:text>&#x0a;</xsl:text>
        </xsl:for-each>
        -->
The error I get is:

[Saxon-B 9.0.0.6] Required item type of value of variable $attrName2 is document-node(); supplied value has item type xs:untypedAtomic

If I un-comment the Dump code following the variable definition, the error goes away.

If I add a single line <text> prior to the attrSubTree definition, the error goes away.

Code:
        <!--
            First, create a subtree with all the attribute names in the Attribute Table
        -->
        <xsl:text>&#x0a;</xsl:text> <-- Added Line

        <xsl:variable name="attrSubTree">
            <xsl:for-each select="$ratttable//TL1Attribute">

                <xsl:variable name="attrName">
                    <xsl:value-of select="."/>
                </xsl:variable>

                <ATTR>
                    <xsl:value-of select="$attrName"/>
                </ATTR>

            </xsl:for-each>
        </xsl:variable>
If, instead, I add the <text> after the attrSubTree definition, the error does not go away.

Does anyone see something that I'm missing?

Thanks
__________________
------------------------
Keep Moving Forward

GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
 
Old January 29th, 2009, 06:06 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default

I fixed the problem (or hid it much better) by removing the <xsl:foreach..$attrAubTree/ATTR..> and writing a template instead.
__________________
------------------------
Keep Moving Forward

GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare





Similar Threads
Thread Thread Starter Forum Replies Last Post
Guidelines Item 3: Replace System.Type with Type Ixtlia BOOK: Professional .NET 2.0 Generics 0 August 19th, 2007 04:09 AM
What's wrong with required field validator? bhavna General .NET 1 February 8th, 2007 10:25 AM
Arguments are of the wrong type???? Seb_soum Classic ASP Databases 12 November 9th, 2006 02:20 PM
Required Field Validator to a datagrid editt item dfalconer Classic ASP Basics 4 September 6th, 2004 03:34 PM
Required Field Validator to a datagrid editt item dfalconer ASP.NET 1.0 and 1.1 Professional 9 September 2nd, 2004 02:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.