This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XSL month sorting (chronologically)


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@jenitennison.com>
>Reply-To: Jeni Tennison <jeni@jenitennison.com>
>To: "murli bk" <bkmurali@hotmail.com>
>CC: XSL-List@lists.mulberrytech.com
>Subject: Re: [xsl] 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]