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

Re: XSL month sorting (chronologically)

Subject: Re: XSL month sorting (chronologically)
From: "murli bk" <bkmurali@xxxxxxxxxxx>
Date: Fri, 12 Apr 2002 13:13:19
javax.xml.transform.transformerexception expected
Hi Jeni,
I made the change you suggested. I use the xalan processor(xalan.jar, crimson.jar). It gives an exception like below. "date" is an xml element and so i think it does not require the quotes.


file:/F:/Ctrack/XSLDateSortExample/TestEx/kay.xsl; Line 34; Column -1; Exception in thread "main" javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ,, but found:
.....



The xsl script modified is


<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<HTML>
 <HEAD>
  <TITLE>
   <xsl:for-each select="eventlog">
   </xsl:for-each>
	MURALI'S MAGIC
  </TITLE>
 </HEAD>

<BODY>

<H3 ALIGN="CENTRE">
  	    EventLog Information
</H3>

  <xsl:for-each select="eventlog">
  <TABLE  border="1">

    <THEAD>
      <TR>
       <TH>Date</TH>
       <TH>Data</TH>
      </TR>
    </THEAD>

<TBODY>

<xsl:for-each select="event">
<xsl:sort select="substring(date, 8, 4)" data-type="number" />
<xsl:sort select="string-length(substring-before('JanFebMarAprMayJunJulAugSepOctNovDec', substring(date,4,3))" data-type="number" />
<xsl:sort select="substring(date, 1, 2)" data-type="number" />


       <TR>
          <TD><xsl:value-of select="date"/></TD>
	   <TD><xsl:value-of select="data"/></TD>
       </TR>


</xsl:for-each>


</TBODY>

</TABLE>

</xsl:for-each>


</BODY>


</HTML>
</xsl:template>
</xsl:stylesheet>

Any idea what is wrong?

Thanks,
Murali.


From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Reply-To: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
To: "murli bk" <bkmurali@xxxxxxxxxxx>
CC: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  XSL month sorting (chronologically)
Date: Fri, 12 Apr 2002 13:35:13 +0100

Hi Murali,

> I tried out Michael's suggestion using string-length. I am getting
> "Whitespace required before attributes" exception. What could be the
> problem.

Your stylesheet isn't well-formed. You're using double quotes inside
an attribute value that is delimited by double quotes:

> <xsl:sort
> select="string-length(substring-before("JanFebMarAprMayJunJulAugSepOctNovDec",
> substring("date",4,3))" data-type="number" />


If you use double quotes to delimit your attribute values, it's best
to use single quotes to delimit XPath strings within those attributes:

<xsl:sort
select="string-length(substring-before('JanFebMarAprMayJunJulAugSepOctNovDec',
substring('date',4,3))" data-type="number" />


You can find the location of this kind of error very simply, using any
XML parser. For example, simply opening the stylesheet in Internet
Explorer will pinpoint the error for you.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com



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.