[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl loop for display in drop-down box

Subject: Re: xsl loop for display in drop-down box
From: "Seema Ramanathan" <sramanathan@xxxxxxxxxxxx>
Date: Fri, 24 Mar 2000 13:46:46 -0800
drop down in xslt
Thanks once again Charlie, I got the desired HTML to show up in Stylus -
yes; the attribute worked!

But Saxon still continues to give me the same error message:
"Cannot write an attribute when there is no open start tag"

Mike, as per your suggestion i did move my xsl:if above the xsl:value.
Inspite of that.............
So here is the XSL which works in Stylus but not in Saxon!

<select name="FIRST">
<xsl:variable name="tmp">
<xsl:value-of select="FIRST/@SELECTED"/></xsl:variable>
<xsl:for-each select="FIRST">
<xsl:element name="option">
<xsl:if test="@SELECTED='Y'">
 <xsl:attribute name="SELECTED"><xsl:value-of select="."/></xsl:attribute>
</xsl:if>
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</select>



----- Original Message -----
From: Charlie Cox <xmldev@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Friday, March 24, 2000 8:14 AM
Subject: Re: xsl loop for display in drop-down box


> xsl is case sensitive. Your xml is mixed
> case(Selected) compared to your xsl which is
> uppercase(SELECTED) for the attribute that you are
> checking.
>
> Mike you are correct, that's just how I got it to
> work. I think I evolved that from an absolute path in
> my xml which didn't work out(and ./ did). I never
> tried without it since it worked. Thanks for the
> correction.
>
> hope this works for you Seema
> Charlie
>
> --- Charlie Cox <xmldev@xxxxxxxxx> wrote:
> > your test for your if should be
> > <xsl:if test="./@SELECTED='Y'">
> >
> > sorry..I always get the path confused for test and
> > select. you need the ./ to indicate it is from the
> > current element(in this case from your for-each)
> >
> > give this a try
> > Charlie
> >
> > --- Seema Ramanathan <sramanathan@xxxxxxxxxxxx>
> > wrote:
> > > Thanks Charlie. But like you said Stylus does not
> > > pick the attribute and
> > > Saxon gives me the following error:
> > > "Cannot write an attribute when there is no open
> > > start tag"
> > >
> > > Like you mentioned i inserted the
> > > <FIRST Selected="Y">Nothing</FIRST>
> > > tag in my XML.
> > >
> > > And then i used the following XSL:
> > >
> > > <select name="FIRST">
> > > <xsl:variable name="tmp"><xsl:value-of
> > > select="FIRST/@SELECTED"/></xsl:variable>
> > >     <xsl:for-each select="FIRST">
> > >         <xsl:element name="option">
> > >         <xsl:value-of select="."/>
> > >          <xsl:if test="@SELECTED='Y'">
> > >               <xsl:attribute
> > > name="SELECTED"><xsl:value-of
> > > select="($tmp)"/></xsl:attribute>
> > >         </xsl:if>
> > >        </xsl:element>
> > >     </xsl:for-each>
> > > </select>
> > >
> > > I get my drop down without a blank but the
> > selected
> > > element is not displayed
> > > first in the drop-down.
> > >
> > > Any more ideas????
> > >
> > > Seema
> > >
> > > ----- Original Message -----
> > > From: Charlie Cox <xmldev@xxxxxxxxx>
> > > To: <xsl-list@xxxxxxxxxxxxxxxx>
> > > Sent: Thursday, March 23, 2000 5:21 AM
> > > Subject: Re: xsl loop for display in drop-down box
> > >
> > >
> > > > if you can, change your 'nothing' line to
> > > > <FIRST Selected="Y">Nothing</FIRST>
> > > > This will elimnate your blank line and still
> > give
> > > you
> > > > the option to mark the selected entry.
> > > >
> > > > then you can change your <option>...</option> to
> > > the
> > > > following:
> > > >
> > > > <xsl:for-each select="FIRST">
> > > > <xsl:element name="option">
> > > >    <xsl:value-of select="."/>
> > > >    <xsl:if select="@Selected='Y'">
> > > >       <xsl:attribute
> > > name="Selected">Y</xsl:attribute>
> > > >    </xsl:if>
> > > >    <xsl:value-of select="($tmp)"/>
> > > > </xsl:element>
> > > > </xsl:for-each>
> > > >
> > > > I have noticed the stylus editor version 1.0
> > does
> > > not
> > > > correctly pick up the attribute under the if
> > > command,
> > > > but it does work correctly in Xalan (EA
> > release).
> > > I
> > > > have not yet tried this with Stylus 2.0,Xalan
> > 1.0
> > > or
> > > > any other xsl parsers.
> > > >
> > > > hope this helps
> > > > Charlie
> > > >
> > > > --- Seema Ramanathan <sramanathan@xxxxxxxxxxxx>
> > > wrote:
> > > > > Hi
> > > > >
> > > > > I have the following XML tag:
> > > > > <TITLE>
> > > > > <FIRST>Something</FIRST>
> > > > > <FIRST>Everything</FIRST>
> > > > > <FIRST Selected="Nothing"></FIRST>
> > > > > </TITLE>
> > > > >
> > > > > I want my XSL to display a drop down box with
> > > the
> > > > > first option to be the selected one - that is
> > > > > "Nothing" followed by the others (Something
> > and
> > > > > Everything).
> > > > >
> > > > > Here is the XSL i use:
> > > > > <select name="FIRST">
> > > > > <xsl:variable name="tmp"><xsl:value-of
> > > > >
> > select="FIRST/@SELE
> > owner-xml-l@xxxxxxxxxxxxxxxxxx Fri Mar 24 14:02:15
> > 2000
> > X-RocketMail: 00000021;R---------------;8520
> > X-Apparently-To: xmldev@xxxxxxxxx via
> > web3902.mail.yahoo.com
> > Return-Path: <owner-xml-l@xxxxxxxxxxxxxxxxxx>
> > X-Track2: 2
> > X-Track: 1: 40
> > Received: from avoca.heanet.ie (193.1.219.117)
> >   by mta225.mail.yahoo.com with SMTP; 24 Mar 2000
> > 14:02:14 -0000
> > Received: from listserv.heanet.ie (avoca.heanet.ie
> > [193.1.219.117])
> > by Avoca.heanet.ie (8.8.8/8.8.8) with ESMTP id
> > OAA00491;
> > Fri, 24 Mar 2000 14:01:15 GMT
> > Received: from LISTSERV.HEANET.IE by
> > LISTSERV.HEANET.IE (LISTSERV-TCP/IP
> >           release 1.8d) with spool id 459493 for
> > XML-L@xxxxxxxxxxxxxxxxxx; Fri,
> >           24 Mar 2000 13:57:21 +0000
> > Received: from urda.heanet.ie (urda.heanet.ie
> > [193.1.219.124]) by
> >           Avoca.heanet.ie (8.8.8/8.8.8) with ESMTP
> > id NAA00439 for
> >           <XML-L@xxxxxxxxxxxxxxxxxx>; Fri, 24 Mar
> > 2000 13:57:20 GMT
> > Received: from polaris.net (nexus.polaris.net
> > [199.44.34.2]) by urda.heanet.ie
> >           (8.9.3/8.9.3) with ESMTP id NAA24236 for
> > <XML-L@xxxxxxxxxxxxxxxxxx>;
> >           Fri, 24 Mar 2000 13:57:19 GMT
> > Received: from 54463pc.ci.tlh.fl.us
> > (52483pc.ci.tlh.fl.us [167.75.225.66]) by
> >           polaris.net (8.9.2/8.7.6) with ESMTP id
> > IAA22642; Fri, 24 Mar 2000
> >           08:57:17 -0500 (EST)
> > X-Sender: simpson@xxxxxxxxxxx
> > X-Mailer: QUALCOMM Windows Eudora Pro Version
> > 4.2.0.58
> > References: <002b01bf955f$23040140$50c809c0@OBELIX>
> > Mime-Version: 1.0
> > Content-Type: text/plain; charset="us-ascii";
> > format=flowed
> > Message-ID:
> > <4.2.0.58.20000324083737.009abaa0@xxxxxxxxxxx>
> > Date:         Fri, 24 Mar 2000 08:56:46 -0500
> > Reply-To: General discussion of Extensible Markup
> > Language
> >               <XML-L@xxxxxxxxxxxxxxxxxx>
> > Sender: General discussion of Extensible Markup
> > Language
> >               <XML-L@xxxxxxxxxxxxxxxxxx>
> > From: "John E. Simpson" <simpson@xxxxxxxxxxx>
> > Subject:      Re: Tr:      Re: XSL
> > To: XML-L@xxxxxxxxxxxxxxxxxx
> > In-Reply-To:  <38DB24B6.3ED2ACCE@xxxxxxxxxxx>
> > Content-Length: 2207
> >
> > At 09:17 AM 3/24/2000 +0100, Fabien Grellier wrote:
> > >... here is XSL stylesheet :
> > >
> > ><?xml version="1.0"?>
> > ><xsl:stylesheet
> > xmlns:xsl="http://www.w3.org/TR/WD-xsl"
> > >   xmlns="http://www.w3.org/TR/REC-html40"
> > >   result-ns="">
> > >
> > >   [...remainder snipped...]
> >
> > I made one change to the stylesheet, which was to
> > replace the above
> > xmlns:xsl attribute to the xsl:stylesheet element
> > with this:
> >
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > Then I used the XT XSLT processor to apply the
> > stylesheet to the XML. The
> > result was:
> >
> >       <?xml version="1.0" encoding="utf-8"?>
> >       <html
> > xmlns="http://www.w3.org/TR/REC-html40"><body>
> >       <TABLE><TR><TD style="
>
> > color:blue">blue</TD></TR></TABLE>
> >
> === message truncated ===
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.