Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2013, 03:46 PM
Registered User
 
Join Date: Aug 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default readable xslt

I wanted to give you an example of how I have been coding and get you to help me understand why it's poor coding (if it is). The technique worked fine through several testing environments but when it got moved to production it suddenly started producing bad (whitespace related) resuts.

This is how I have been coding:
<Purpose>
<xsl:attribute name="tc">1000800007</xsl:attribute>
Guarantee Minimum Future Income
</Purpose>

Through testing this normally produces:

<Purpose tc="1000800007"> Guarantee Minimum
Future Income </Purpose>


But when the xslt was moved to production it produced this:

<Purpose tc="1000800007"> ..........Guarantee Minimum
Future Income.......... </Purpose>


I know that all the dots represent spaces, newline codes and tabs. I guess two questions. One, any idea why it transformed ok in one environment but not in another. Two, is the way I am coding just flat out bad coding and if so what would be the proper way to code.
 
Old August 15th, 2013, 04:02 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I can't see exactly where the whitespace is in the stylesheet or hte output so it's hard to be sure which is right; also you haven't given any details of how the transformation was run or what serialization parameters were used.

The xsl:attribute instruction here is quite unnecessary, you could use a literal attribute in the stylesheet:
Code:
<purpose tc="100080007">...
Generally it's probably good practice to surround literal text in the stylesheet with an xsl:text element to get better control of whitespace handling.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
bonekrusher (August 19th, 2013)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to Log Data changes in readable format David92595 SQL Server 2008 1 February 23rd, 2012 02:24 AM
web.config is still readable after compiling!? mzsohi BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 September 13th, 2009 07:30 AM
Converting enumerated value to readable value maigoro ASP.NET 3.5 Basics 2 April 11th, 2008 09:46 AM
zxml.js - is there a readable copy available? bobwazz BOOK: Professional Ajax ISBN: 978-0-471-77778-6 3 May 17th, 2007 09:21 AM
WordML to readable XML ROCXY XSLT 1 December 22nd, 2006 08:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.