xsl-list
[Top] [All Lists]

Re: Generic Dropdown template

2003-03-24 09:30:10


        <xsl:for-each select="$xpath">          


In common with most other programming languages, XSLT/XPath does not
allow expressions as first class objects, or as values of variables.

So despite its name, $xpath, can not be holding an XPath.
Your code would work if it is holding a node set, many APIs to XSLT
processors allow params to be initialised with node sets by using a DOM
interface to Xpath for example. Most command line interfaces do not
allow this. If you parameter holds a string then this will not work,
you can not for-each over a string.

As you haven't shown teh value of $xpath it's hard to be more specific.


Unrelated but
<option>                                
                                <xsl:attribute name="value">                    
                
                                        <xsl:value-of select="ID"/>             
                
                                </xsl:attribute>        

is a very long winded way of expressing this, you could use

<input value="{ID}">


And as repeatedly stated on this list
        <xsl:attribute name="selected">
                                                        true
                                        </xsl:attribute>        
is incorrect, <option selected> is the short form of
<option selected="selected">
not
<option selected="true">

If you use
<option selected="selected">
it will be output as
<option selected> 
in the html output method and be valid HTML, whereas selected="true" is
an html syntax error, although some browsers may silently correct the
error.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



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