str:align - left padding problem

"Kazan Glenn" <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>
using the simple XML file


<source>
<author>Adam Gutteridge</author>
</source>


and XSLT file


<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xalan="http://xml.apache.org/xslt"
  xmlns:str="http://exslt.org/strings"
  extension-element-prefixes="str">

<xsl:template match="/">
<xsl:value-of select="concat(//author, substring('bbb---------------------eee', string-length(//author) + 1))"/>,
<xsl:value-of select="str:align(//author, 'bbb---------------------eee', 'left')"/>,
<xsl:value-of select="str:align(//author, 'bbb---------------------eee', 'center')"/>,
<xsl:value-of select="str:align(//author, 'bbb---------------------eee', 'right')"/>,
</xsl:template>

</xsl:stylesheet>


I get the following output, where the left padding is wrong using str:align (see the third line of the output). I am using xalan-java 2.6.0. To test that there were no underlying problems with xalan I created a left alignment statement that does work using concat and string-length directly.


<?xml version="1.0" encoding="UTF-8"?>
Adam Gutteridge---------eee,
Adam Gutteridge------------eee,
bbb---Adam Gutteridge---eee,
bbb---------Adam Gutteridge,


The immediate solution is to use the concat/string-length directly whenever left aligned strings are required.
hope this is useful,

Kazan Glenn.

_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.