[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: [xml-dev] Sorting Problem
Thanks for u'r reply guys. But the thing is that it'll be a little time consuming if I've to change the things in my XML document. Because I'm pulling it directly from a huge database which has thousands of entries. Second thing is when I tried to use <xsl:template match> instead of <xsl:for-each select>,I get the data from my xml file which I'm not even selecting in my stylesheet to be displayed.That data is being displayed randomly along with other data. Regards and thanks a lot for all the help, Puja --- Mike Fitzgerald <mike@xxxxxxxxxx> wrote: > Puja, > > xsl:template matches patterns; xsl:for-each is a > child of xsl:template that > iterates nodes within that pattern, depending on the > value of select. > xsl:for-each may not be what you want. Try something > like this (I mocked up > your source elements): > > C:\XML\Examples>cat puja.xml > <dataroot> > <GrantNet fldCatID="x001">1</GrantNet> > <GrantNet fldCatID="x003">3</GrantNet> > <GrantNet fldCatID="x006">6</GrantNet> > <GrantNet fldCatID="x005">5</GrantNet> > <GrantNet fldCatID="x002">2</GrantNet> > <GrantNet fldCatID="x004">4</GrantNet> > <GrantNet fldCatID="x007">7</GrantNet> > </dataroot> > > C:\XML\Examples>cat puja.xsl > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output method="text"/> > > <xsl:template match="dataroot"> > <xsl:apply-templates select="GrantNet"> > <xsl:sort select="@fldCatID"/> > </xsl:apply-templates> > </xsl:template> > > </xsl:stylesheet> > > C:\XML\Examples>xalan puja.xml puja.xsl > 1234567 > C:\XML\Examples> > > I can't be sure of what you want without seeing your > source document. Good > luck. > > Mike > > > -----Original Message----- > > From: puja thakral [mailto:puja_thakral@xxxxxxxxx] > > Sent: Thursday, October 16, 2003 9:07 AM > > To: List; xml > > Subject: [xml-dev] Sorting Problem > > > > > > Hi everyone, > > I'm also having sorting problems.I'm using > > > > <xsl:for-each select="dataroot/GrantNet"> > > <xsl:sort select="@fldCatID"/> > > </xsl:for-each> > > > > this code to sort my items by fldCatID but it > doesn't > > seems to work. > > > > I also have one more question.I'm still learning > > xml/xsl.What is the difference between using > > <xsl:for-each select> and <xsl:template match> > > I tried using both of them but some functions seem > to > > work in one and not in another.Can someone pls > clarify > > the basic question.I'm sorry if u find this > question > > too dumb but there is noone working on this in my > > office whom I can ask?Also I could not find a > > convincing answer by searching on Google. > > Thanks guys, > > Puja > > > > __________________________________ > > Do you Yahoo!? > > The New Yahoo! Shopping - with improved product > search > > http://shopping.yahoo.com > > > > > ----------------------------------------------------------------- > > The xml-dev list is sponsored by XML.org > <http://www.xml.org>, an > > initiative of OASIS <http://www.oasis-open.org> > > > > The list archives are at > http://lists.xml.org/archives/xml-dev/ > > > > To subscribe or unsubscribe from this list use the > subscription > > manager: <http://lists.xml.org/ob/adm.pl> > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|