You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/04/09 17:05:38 UTC

DO NOT REPLY [Bug 7875] New: - xsltc fails mk041 test

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7875>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7875

xsltc fails mk041 test

           Summary: xsltc fails mk041 test
           Product: XalanJ2
           Version: CurrentCVS
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: tom.amiro@sun.com


The following expression is returning nothing; it should return the name 
of the month for the current node. As far as we know the 'document' and 
'lang' functions work. Most likely the problem is name space related.

   <xsl:value-of select="document('')/*/data:data/data:months[lang($language)]/d
ata:m[$month]"/>

Obtained Output
===============
<?xml version="1.0" encoding="iso-8859-1" ?>

<date>16  1999</date>
<date>08  1999</date>
<date>13  1999</date>
<date>09  1999</date>
<date>21  1999</date>
<date>16  1998</date>
<date>18  1998</date>

Expected Output
===============
<?xml version="1.0" encoding="iso-8859-1"?>

<date>16 November 1999</date>
<date>08 October 1999</date>
<date>13 August 1999</date>
<date>09 July 1999</date>
<date>21 April 1999</date>
<date>16 December 1998</date>
<date>18 August 1998</date>

XSL
===

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:transform
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0"
>

  <!-- Test FileName: mk041.xsl -->
  <!-- Source Attribution:
       This test was written by Michael Kay and is taken from
       'XSLT Programmer's Reference' published by Wrox Press Limited in 2000;
       ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserve
d.
       Now updated in the second edition (ISBN 1861005067), http://www.wrox.com.
       No part of this book may be reproduced, stored in a retrieval system or
       transmitted in any form or by any means - electronic, electrostatic, mech
anical,
       photocopying, recording or otherwise - without the prior written permissi
on of
       the publisher, except in the case of brief quotations embodied in critica
l articles or reviews.
  -->
  <!-- Example: issue-dates.xml, format-dates.xsl -->
  <!-- Chapter/Page: 7-476 -->
  <!-- Purpose: Using lang function for localizing dates -->

<xsl:output encoding="iso-8859-1"/>
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:transform
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0"
>

  <!-- Test FileName: mk041.xsl -->
  <!-- Source Attribution:
       This test was written by Michael Kay and is taken from
       'XSLT Programmer's Reference' published by Wrox Press Limited in 2000;
       ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserve
d.
       Now updated in the second edition (ISBN 1861005067), http://www.wrox.com.
       No part of this book may be reproduced, stored in a retrieval system or
       transmitted in any form or by any means - electronic, electrostatic, mech
anical,
       photocopying, recording or otherwise - without the prior written permissi
on of
       the publisher, except in the case of brief quotations embodied in critica
l articles or reviews.
  -->
  <!-- Example: issue-dates.xml, format-dates.xsl -->
  <!-- Chapter/Page: 7-476 -->
  <!-- Purpose: Using lang function for localizing dates -->

<xsl:output encoding="iso-8859-1"/>

<data xmlns="data.uri">
<months xml:lang="en">
   <m>January</m><m>February</m><m>March</m><m>April</m>
   <m>May</m><m>June</m><m>July</m><m>August</m>
   <m>September</m><m>October</m><m>November</m><m>December</m>
</months>
<months xml:lang="fr">
   <m>Janvier</m><m>F\351vrier</m><m>Mars</m><m>Avril</m>
   <m>Mai</m><m>Juin</m><m>Juillet</m><m>Ao\373t</m>
   <m>Septembre</m><m>Octobre</m><m>Novembre</m><m>D\351cembre</m>
</months>
<months xml:lang="de">
   <m>Januar</m><m>Februar</m><m>M\344rz</m><m>April</m>
   <m>Mai</m><m>Juni</m><m>Juli</m><m>August</m>
   <m>September</m><m>Oktober</m><m>November</m><m>Dezember</m>
</months>
</data>

<xsl:param name="language" select="'en'"/>

<xsl:template match="iso-date">
<date xmlns:data="data.uri" xsl:exclude-result-prefixes="data">
   <xsl:value-of select="substring(., 7, 2)"/>
   <xsl:text> </xsl:text>
   <xsl:variable name="month" select="number(substring(.,5,2))"/>
   <xsl:value-of select="document('')/*/data:data/data:months[lang($language)]/d
ata:m[$month]"/>
   <xsl:text> </xsl:text>
   <xsl:value-of select="substring(., 1, 4)"/>
</date>
</xsl:template>

XML
===
<issues>
<iso-date>19991116</iso-date>
<iso-date>19991008</iso-date>
<iso-date>19990813</iso-date>
<iso-date>19990709</iso-date>
<iso-date>19990421</iso-date>
<iso-date>19981216</iso-date>
<iso-date>19980818</iso-date>
</issues>