XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Joe SimsSubject: tabs converted to spaces
Author: Joe Sims
Date: 20 Jul 2005 01:26 PM
Originally Posted: 20 Jul 2005 01:22 PM
The problem I seem to be having is that when I run my transformation is that my tabs inside of my attribute values (which are vital since this is for an InfoPath Document) are begin translated in to spaces. I have tried tinkering with the tab setting within the options but to no prevail. I believe this problem may be routed in the tokenizing. I think there may not be a token for a tab only for a space, and thus when the tool reads whitespace it assumes it to be a space and thus my tabs become spaces. Any idea on how to maintain this whitespace other ways? Thanks in advance.

Postnext
Alberto MassariSubject: tabs converted to spaces
Author: Alberto Massari
Date: 20 Jul 2005 03:39 PM
Hi Joe,
the problem is that XML mandates that the content of an attribute should be normalized to convert line feed, carriage return and tab characters into plain spaces (see http://www.w3.org/TR/2004/REC-xml-20040204/#AVNormalize). So, if you really have to place tabs inside attributes, you should escape them as character entities (	)

Hope this helps,
Alberto

Postnext
Joe SimsSubject: tabs converted to spaces
Author: Joe Sims
Date: 20 Jul 2005 04:13 PM
Thank you replying to quickly but I just dont understand what you mean for me to do with the (	)? I need the tabs to be preserved in the element below (the value attribute) is it possible for you to show me what you mean?

<sox:Property name="Control Objective(s)" type="multiselect">
<xsl:attribute name="value">
<xsl:value-of select="sox:control/sox:Component/sox:Properties/sox:Property[1]/@value"/>

Postnext
Alberto MassariSubject: tabs converted to spaces
Author: Alberto Massari
Date: 21 Jul 2005 04:19 AM
Hi Joe,
the code you write will correctly create an attribute with a value containing tabs, if they are present in the XML node you are selecting. The issue is when you load the generated XML using a parser: in that moment the tabs will be replaced by spaces, because this is what the XML specs mandate.
There are ways to make so that the XSL generates strings like '&#x9;' instead of tabs, but unfortunately when used inside attribute values they get further processed into '&amp;#x9;'.

Summarizing, I see only these workarounds:
1) don't place tabs into attribute values (e.g. use a text node)
2) post-process the XML to replace the tabs with the entity reference

Note: the issue would appear also for new line characters (CR and LF)

Hope this helps,
Alberto

Posttop
Joe SimsSubject: tabs converted to spaces
Author: Joe Sims
Date: 21 Jul 2005 09:09 AM
Yea helps a lot. Thanks!

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.