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

Re: Problems with sort.

Subject: Re: Problems with sort.
From: "Brian Burridge" <brian_burridge@xxxxxxxxxxxxx>
Date: Mon, 12 Jun 2000 10:07:46 -0400
brian kay architect
That worked, but there is one more aspect of it that I need to figure out.
Some of the sort keys the user can select are text, and some are numeric.
Some how I need to toggle back and forth (data-type). I was thinking I could
have setup a global variable and set it according to if statements, like if
/PAGE/@sort is "project number" then set the global variable to number.

What I'm not sure is:

a) Where in an XSL document would you put the if statements to setup the
global variable?
b) How would I put the value of the global variable into the data-type
attribute of the sort? Would I use the same command you gave me for the
select attribute? If the global variable was "dataType", would it be
data-type="*[name()=dataType]"?

Brian

Kay Michael wrote:

> > I want it to sort by whatever the element
> > is in /PAGE/@sort.
>
> Ah, I see now.
> <xsl:sort select="*[name()=/PAGE/@sort]"/>
>
> Mike Kay
>
> > I have tried so many combinations to try and tell it where to find the
> > attribute @sort. I'm assuming that not finding it is what's
> > causing it not to
> > sort.
> >
> > <?xml version="1.0"?>
> > <PAGE title="Display Projects" sort="title">
> > <projects>
> >                 <project>
> >                                 <number>
> >                                         1114
> >                                 </number>
> >                                 <title>
> >                                         Test Title
> >                                 </title>
> >                                 <site_code>
> >                                         INCTM
> >                                 </site_code>
> >                                 <department>
> >                                         0
> >                                 </department>
> >                 </project>
> > </PAGE>
> >
> > <xsl:template match="projects">
> >   <xsl:apply-templates>
> >    <xsl:sort select="Here is where I need help!"/>
> >   </xsl:apply-templates>
> >  </xsl:template>
> >
> > Brian
> >
> > Kay Michael wrote:
> >
> > > > I have this code:
> > > >
> > > >   <xsl:apply-templates>
> > > >    <xsl:sort select="/PAGE/@sort"/>
> > > >   </xsl:apply-templates>
> > > >
> > > > It doesn't give an error, but isn't sorting by the value of
> > > > "/PAGE/@sort".
> > >
> > > Since the sort key is an absolute path, its value doesn't
> > depend on the
> > > context node, so it will have the same value for every node
> > in the node-set
> > > you are trying to sort. Sort keys should normally be relative paths.
> > >
> > > Mike Kay
> > >
> > >  XSL-List info and archive:
> > http://www.mulberrytech.com/xsl/xsl-list
> >
> > --
> >
> > Brian N.
> > Burridge
> > Internet Architect
> > (727) 399-3000 Ext 3515
> > The Internet Group - ITSS
> > Cox Target Media
> >
> > "Until a person can say deeply and honestly, "I am what I am
> > today because of
> > the choices I made yesterday," that person cannot say, "I
> > choose otherwise."
> >
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

--

Brian N. Burridge
Internet Architect
(727) 399-3000 Ext 3515
The Internet Group - ITSS
Cox Target Media

"Until a person can say deeply and honestly, "I am what I am today because
of the choices I made yesterday," that person cannot say, "I choose
otherwise."



 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.