[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xsl:sort and xsl:count issues
Hi, I've been working with a OAI-PMH complaint tool and I need to
present the XML data harvested from it in a website. I've accomplished
it so far by creating a XSL file, but encountered some difficulties in
the implementation of severals aspects.
Basicly the XML is exported in the structure shown below: <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="gris2.xsl"?> <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> <responseDate>2004-11-15T13:21:38Z</responseDate> <request verb="ListRecords" metadataPrefix="oai_dc">http://resgenchem15.chem.wisc.edu/spt/SPT--OAI.php</request> <ListRecords> <record> <header> <identifier>oai:jce.divched.org:jcedlib-58</identifier> <datestamp>2003-06-03</datestamp> </header> <metadata> <oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance""http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:title>Journal of Chemical Education Digital Library</dc:title> <dc:creator>John W. Moore</dc:creator> <dc:creator>Jon L. Holmes</dc:creator> <dc:creator>Edward W. Vitz</dc:creator> <dc:creator>William F. Coleman</dc:creator> <dc:creator>Theresa J. Zielinski</dc:creator> <dc:description>The JCE Digital Library (JCE DLib) was established in 2003 as a result of an NSF grant. It is a part of the NSDL, and initially includes four features: WebWare, DigiDemos, QBank, and SymMath.</dc:description> <dc:publisher>The Division of Chemical Education, Inc., of the American Chemical Society</dc:publisher> <dc:date>2003-01-01</dc:date> <dc:type>Collection</dc:type> <dc:format>text/html</dc:format> <dc:identifier>http://jce.divched.org/JCEDLib/</dc:identifier> <dc:language>en</dc:language> <dc:relation> isPartOf: ISSN:0021-9584</dc:relation> <dc:rights>Copyright 2003 by the Division of Chemical Education, Inc., American Chemical Society.</dc:rights> <dc:subject>Elementary / Middle School</dc:subject> <dc:subject>High School / Introductory Chemistry</dc:subject> <dc:subject>First-Year Undergraduate / General</dc:subject> <dc:subject>Graduate Education / Research</dc:subject> <dc:subject>General Public</dc:subject> <dc:subject>Second-Year Undergraduate</dc:subject> <dc:subject>Upper-Division Undergraduate</dc:subject> <dc:subject>Continuing Education</dc:subject> <dc:subject>Analytical Chemistry</dc:subject> <dc:subject>Chemical Education Research</dc:subject> <dc:subject>Inorganic Chemistry</dc:subject> <dc:subject>Laboratory Instruction</dc:subject> <dc:subject>Physical Chemistry</dc:subject> <dc:subject>Organic Chemistry</dc:subject> <dc:subject>Biochemistry</dc:subject> </oai_dc:dc> </metadata> </record> <record> . . . </record> </ListRecords> </OAI-PMH> Each record as a certain type, described in "dc:type", which may vary as Paper, Journal, Article, etc; When harvesting data from the repository, I'll be accessing all the records of a given person, identified in "dc:creator", which returns a XML sorted by "dc:date"; I want to present this data in HTML in a structure similar to the one below: Type1: creator, title, date, publisher. (background color for odd row) creator, title, date, publisher. (background color for even row) Type2: creator, title, date, publisher (background color for odd row) creator, title, date, publisher (background color for even row) So far I've managed to perform a simple transformation by applying this XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="dc" xmlns:def="http://www.openarchives.org/OAI/2.0/"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <head> <link rel="stylesheet" href="oai.css" type="text/css"/> </head> <body id="body"> <xsl:for-each select="//def:record"> <!-- Creator data manipulation --> <xsl:for-each select="def:metadata//dc:creator"> <xsl:value-of select="."/> , </xsl:for-each> <!-- Title manipulation --> <i> <xsl:value-of select="def:metadata//dc:title"/> </i> . <br/> <!-- Publisher manipulation --> <xsl:value-of select="def:metadata//dc:publisher"/> , <!-- Date manipulation --> <xsl:value-of select="def:metadata//dc:date"/> . <br/> <br/> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> I've tried to perform the sort by introducing <xsl:sort select="def:metadata//dc:title"> right next to the <xsl:for-each ...> tag but it returned a blank document. How can I do this sorting of the records and how can I identify if the current record number is even or odd in order to perform diferent customizations? Sorry for the lenght of the mail and thanks in advance, Rolando xmlns:oai_dc=
|
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
|