freelanceprogrammers.org Forum Index » XML / XSL

White Space


View user's profile Post To page top
terry.badger@... Posted: Wed Jun 25, 2003 2:58 pm


Joined: 25 Jun 2003

Posts: 2
White Space
My input file is
<wrapper>
<para><sub>text1</sub> <sub>text2</sub>stuff</para>
</wrapper>
I want to get and push through with an xsl the space between text1 and
text2 that is content of para. Using Saxon but the whitespace is being
stripped. Any Ideas?
Reply with quote
Send private message
View user's profile Post To page top
g_ken_holman Posted: Wed Jun 25, 2003 5:16 pm


Joined: 13 Jun 2003

Posts: 10
White Space
At 2003-06-25 05:58 -0400, terry.badger@... wrote:
>My input file is
><wrapper>
><para><sub>text1</sub> <sub>text2</sub>stuff</para>
></wrapper>
>I want to get and push through with an xsl the space between text1 and
>text2 that is content of para. Using Saxon but the whitespace is being
>stripped. Any Ideas?

By default all whitespace is significant to XPath/XSLT 1.0 ... using the
SHOWTREE stylesheet available as a free resource from our web site noted
below, I can see that that space character *is* being preserved by Saxon 6.5.2.

Perhaps you are using xsl:strip-space?

I hope this helps.

............................ Ken

T:ftemp>copy con terry.xml
<wrapper>
<para><sub>text1</sub> <sub>text2</sub>stuff</para>
</wrapper>
^Z
1 file(s) copied.

T:ftemp>showtree terry.xml

T:ftemp>type terry.xml.shw
SHOWTREE Stylesheet
Processor: SAXON 6.5.2 from Michael Kay
1 Element `wrapper`:
1.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.1 Text (wrapper): {
}
1.2 Element `para` (wrapper):
1.2.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.2.1 Element `sub` (wrapper,para):
1.2.1.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.2.1.1 Text (wrapper,para,sub): {text1}
1.2.2 Text (wrapper,para): { }
1.2.3 Element `sub` (wrapper,para):
1.2.3.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.2.3.1 Text (wrapper,para,sub): {text2}
1.2.4 Text (wrapper,para): {stuff}
1.3 Text (wrapper): {
}
T:ftemp>


--
Upcoming hands-on courses: XSLT/XPath North America: Aug 12, 2003
- XSL-FO North America: Aug 4, 2003

G. Ken Holman mailto:gkholman@...
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners: http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/x/bc
Reply with quote
Send private message
View user's profile Post To page top
terry.badger@... Posted: Wed Jun 25, 2003 6:17 pm


Joined: 25 Jun 2003

Posts: 2
White Space
Thank You Ken.
I got your walker and got the same thing when I used Saxon which I thought
I was but was not.
I was using xmlSpy with their default xslt and got this:
SHOWTREE Stylesheet - http://www.CraneSoftwrights.com/resources/
Processor: Altova GmbH & Altova, Inc.
1 Element `wrapper`:
1.1 Element `para` (wrapper):
1.1.1 Element `sub` (wrapper,para):
1.1.1.1 Text (wrapper,para,sub): {text1}
1.1.2 Element `sub` (wrapper,para):
1.1.2.1 Text (wrapper,para,sub): {text2}
1.1.3 Text (wrapper,para): {stuff}
and you can see the whitespace is missing.
So now I know what to do and would say you treewalker.xsl is great.
I was going nuts yesterday.




"G. Ken Holman" <gkholman@...>
06/25/2003 08:16 AM
Please respond to xml-doc


To: xml-doc@yahoogroups.com
cc:
Subject: Re: [xml-doc] White Space


At 2003-06-25 05:58 -0400, terry.badger@... wrote:
>My input file is
><wrapper>
><para><sub>text1</sub> <sub>text2</sub>stuff</para>
></wrapper>
>I want to get and push through with an xsl the space between text1 and
>text2 that is content of para. Using Saxon but the whitespace is being
>stripped. Any Ideas?

By default all whitespace is significant to XPath/XSLT 1.0 ... using the
SHOWTREE stylesheet available as a free resource from our web site noted
below, I can see that that space character *is* being preserved by Saxon
6.5.2.

Perhaps you are using xsl:strip-space?

I hope this helps.

............................ Ken

T:ftemp>copy con terry.xml
<wrapper>
<para><sub>text1</sub> <sub>text2</sub>stuff</para>
</wrapper>
^Z
1 file(s) copied.

T:ftemp>showtree terry.xml

T:ftemp>type terry.xml.shw
SHOWTREE Stylesheet
Processor: SAXON 6.5.2 from Michael Kay
1 Element `wrapper`:
1.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.1 Text (wrapper): {
}
1.2 Element `para` (wrapper):
1.2.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.2.1 Element `sub` (wrapper,para):
1.2.1.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.2.1.1 Text (wrapper,para,sub): {text1}
1.2.2 Text (wrapper,para): { }
1.2.3 Element `sub` (wrapper,para):
1.2.3.I Namespace `xml`: {http://www.w3.org/XML/1998/namespace}
1.2.3.1 Text (wrapper,para,sub): {text2}
1.2.4 Text (wrapper,para): {stuff}
1.3 Text (wrapper): {
}
T:ftemp>


--
Upcoming hands-on courses: XSLT/XPath North America: Aug 12, 2003
- XSL-FO North America: Aug 4, 2003

G. Ken Holman mailto:gkholman@...
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners: http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/x/bc


-------------------------------------------------------------------
Post a message: mailto:xml-doc@yahoogroups.com
Unsubscribe: mailto:xml-doc-unsubscribe@yahoogroups.com
Switch to digest: mailto:xml-doc-digest@yahoogroups.com
Put mail on hold: mailto:xml-doc-nomail@yahoogroups.com
Contact adminstrator: mailto:xml-doc-owner@yahoogroups.com
Make changes via Web: http://groups.yahoo.com/subscribe/xml-doc/
Read archived messages: http://groups.yahoo.com/messages/xml-doc/
-------------------------------------------------------------------

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/







[Non-text portions of this message have been removed]
Reply with quote
Send private message
View user's profile Post To page top
g_ken_holman Posted: Wed Jun 25, 2003 7:01 pm


Joined: 13 Jun 2003

Posts: 10
White Space
At 2003-06-25 09:17 -0400, terry.badger@... wrote:
>I got your walker and got the same thing when I used Saxon

Good!

>which I thought
>I was but was not.
>I was using xmlSpy with their default xslt and got this:
>SHOWTREE Stylesheet - http://www.CraneSoftwrights.com/resources/
>Processor: Altova GmbH & Altova, Inc.
>1 Element `wrapper`:
>1.1 Element `para` (wrapper):
>1.1.1 Element `sub` (wrapper,para):
>1.1.1.1 Text (wrapper,para,sub): {text1}
>1.1.2 Element `sub` (wrapper,para):
>1.1.2.1 Text (wrapper,para,sub): {text2}
>1.1.3 Text (wrapper,para): {stuff}
>and you can see the whitespace is missing.

Then it looks like XML Spy is not conformant to XPath/XSLT 1.0 ... by
default *all* white-space in an XML document is significant.

>So now I know what to do and would say you treewalker.xsl is great.
>I was going nuts yesterday.

Not sure where you got that name ... it is actually called showtree.xsl
when you get it from the web site. The result is verbose, but it is a
complete exposition of the XPath 1.0 data model for an XML instance as seen
by an XSLT 1.0 processor.

I`m glad it was helpful.

................ Ken


--
Upcoming hands-on courses: XSLT/XPath North America: Aug 12, 2003
- XSL-FO North America: Aug 4, 2003

G. Ken Holman mailto:gkholman@...
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners: http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/x/bc
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help