Re: [xsl] Node-sets using <xsl:with-param>

Subject: Re: [xsl] Node-sets using <xsl:with-param>
From: Mir Farooq Ali <miali@xxxxxxxxx>
Date: Thu, 22 Jan 2004 14:58:41 -0500
G. Ken Holman wrote:

If that is your entire stylesheet, then no built-in template rules are engaged between the two above fragments because the right-most step in the select is "*" (all elements wildcard) and the right-most step in the match is "*" (any element wildcard).


Which processor are you using? I'm suspecting an implementation problem.

With only the evidence you have posted, I would anticipate the data type of the curnode parameter to be "node set". I agree the default is "empty string" which would give you the error, but it seems obvious from your fragment that it would only be engaged by the given apply-templates because of your use of modes. I would think you would only get the error reported if the element being pushed at your stylesheet was pushed without an argument specified for the curnode parameter (as is true for the built-in template rule for elements).

Any template rule in your stylesheet is more important than the built-in template rules ... they *only* get used if you do not supply any template rule for the given node in the given mode. And when they are used, parameters are not preserved.

Sorry I cannot tell what is wrong from your fragment. If you post a short XML source file that triggers the error with this stylesheet fragment, then others could try the fragments with different processors.

I hope this helps.

........................... Ken

Thank you for your explanation about built-in templates.


This is the xml source file on which I'm using the stylesheet

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by Mir Farooq Ali (Computer Science, Virginia Tech) -->
<TM>
<T Identifier="Manage appointments" Category="abstraction">
<Type>Group</Type>
<Prefs>
<UC>1</UC>
<UPS>1</UPS>
</Prefs>
<ST>
<T Identifier="Add appointment" Category="abstraction">
<Type>Group</Type>
<Prefs>
<UC>1</UC>
<UPS>2</UPS>
</Prefs>
<ST>
<T Identifier="Enter Date" Category="interaction">
<Type>Edit</Type>
<Prefs>
<UC>1</UC>
<UPS>2</UPS>
</Prefs>
</T>
<T Identifier="Enter Time" Category="interaction">
<Type>Edit</Type>
<Prefs>
<UC>1</UC>
<UPS>1</UPS>
</Prefs>
</T>
</ST>
</T>
</ST>
</T>
</TM>


and this is the lookup file

<?xml version="1.0" encoding="UTF-8"?>
<TM xmlns:G="http://www.w3.org/2001/XMLSchema";>
    <TC name="interaction">
        <TTM type="Edit">
            <UCM prefnum="1">
                <UC>Text</UC>
                <UPS>
                    <part prefnum="1"><G:T/></part>
                    <part prefnum="2"><G:L/></part>
                </UPS>
            </UCM>
            <UCM prefnum="2">
                <UC>Inputter</UC>
                <UPS>
                    <part prefnum="1"><G:B/></part>
                </UPS>
            </UCM>
        </TTM>
    </TC>
    <TC name="abstraction">
        <TTM type="Group">
            <UCM prefnum="1">
                <UC/>
                <UPS>
                    <part prefnum="1">
                        <G:TC>
                            <G:L/>
                            <G:Te/>
                        </G:TC>
                    </part>
                    <part prefnum="2"><G:A/></part>
                </UPS>
            </UCM>
        </TTM>
    </TC>
</TM>

I've tried running it with Saxon 7.8 (the latest version) and Xalan. Both give similar error messages.

Error at apply-templates on line 41 of file:/D:/apptnew1.xslt:
Required type of select attribute of xsl:apply-templates is node; supplied value is xs:string
Transformation failed: Run-time errors were reported


The output that I want (maybe somebody can point me to a better way of doing it) for this input file is

<?xml version="1.0" encoding="UTF-8" ?>
<UI>
    <STR>
        <part class="G:TC" id="Manage_appointments1">
            <part class="G:L" id="Manage_appointments11" />
            <part class="G:Te" id="Manage_appointments12" />
            <part class="G:A" id="Add_appointment1">
                <part class="G:T" id="Enter_Time1" />
                <part class="G:L" id="Enter_Date1"></part>
            </part>
        </part>
    </STR>
</UI>

Thanks,

-Farooq.
--
Mir Farooq Ali

Computer Science, Virginia Tech,
Email: miali@xxxxxxxxx
Web: http://purl.org/net/farooq
Office: 525 McBryde Hall
Tel: (540) 231-1927 (Office)
--------------------------------------------
(c) 2004 Mir Farooq Ali  All rights reserved
--------------------------------------------


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread