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

Data types and xsl:sequence

Subject: Data types and xsl:sequence
From: "Jim Neff" <jneff@xxxxxxxxxxxxxxx>
Date: Mon, 24 Jan 2005 16:17:41 -0500
xsl data
Greetings,

I'm having trouble understanding data types and using the function
xsl:sequence.

I have one common template that I call to create padding in my output
document:

<xsl:template name="pad-number">
		
   <xsl:param name="max" />
   <xsl:param name="char" />

   <xsl:sequence select="string-join((for $i in 1 to xs:integer($max) return
$char), '')"/>
		
</xsl:template>


So if I am padding for a text field, I pass in &#x20; for a space and if
it's a numeric field I use '0'.

My problem is (and I know this sounds silly) whenever I change from a text
to a numeric field there is an extra space inserted into the xsl:sequence
output.  This is a space and not the character I am passing into this
template.  So, if I use a tilda '~' instead of '&#x20;' I see the
appropriate number of tildas plus a space (hex code 20) in my output.

I do not have this problem when I am not changing from numeric to text, or
if I have consecutive numerics or consecutive text fields.

Perhaps I am not using the $max variable correctly?  I found the only way to
get it to work is when I specify xs:integer around it because the portion of
code that calls this template is performing a calculation and I think the
processor (Saxon 8.something) is creating a mandotory xs:double whenever a
calculation is performed.

This is probably a logic problem and has nothing to do with XSLT syntax but
I just thought I'd throw this out here and maybe one of the gurus on this
list could point me in the right direction.

Thanks,
Jim Neff

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.