|
next
|
Subject: Substring-function problem in Stylus (second) Author: Andreas Riegg Date: 31 Aug 2000 10:24 AM
|
Hi,
I'm using Stylus 2.0.08 and do some examples with the JavaML stuff from http://www.cs.washington.edu/homes/gjb/JavaML/. Using the stylesheet examples that convert the JavaML examples to HTML or Java source back, I encountered a problem with the substring-function in Stylus. In one of the templates, the following statement is used (I replaced the angle brackets by these {} brackets):
{xsl:value-of select="substring('[][][][][][][][][][][][][][][][][]',1,@dimensions * 2)"/}
This code is used to generate type declarations in Java that have a dimension. However, in most cases the associated dimension is missing (which equals to zero?, the DTD has no default value for this attribute) which leads to an actual expression in the following form:
{xsl:value-of select="substring('[][][][][][][][][][][][][][][][][]',1,0)"/}.
The output in this case should be none of the []-brackets, but instead always all of the brackets appear in the result. Even changing the third argument of the substring-function from @dimensions * 2 to direct hard coded 0 creates the same wrong result. So even when the missing attribute may not default to zero, a hardcoded zero should lead to the correct result.
Additional info: I tried the same sheet in the XSLT-tools of the eXcelon explorer and it worked correctly there.
Dr. Andreas Riegg
DaimlerChrysler AG
ITM - SP&D/ED
Email: andreas.riegg@daimlerchrysler.com
(Please use this email, not my old one at debis!)
|
|
|