WhiteSpace
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 8
- Joined: Tue Feb 15, 2005 12:00 am
WhiteSpace
I have a xsl which copies a xml file to another xml file while inserting new elements,attributes etc. I use MSXSL to do the transform.
I have noticed in while looking under the hex editor that the newer xml the whitespaces have changed there were place which had a 2 bit whitespace which is converted to a 5 bit whitespace.
I do not know why t his happens.Can i preserve the whitespace.?
I have noticed in while looking under the hex editor that the newer xml the whitespaces have changed there were place which had a 2 bit whitespace which is converted to a 5 bit whitespace.
I do not know why t his happens.Can i preserve the whitespace.?
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
What do you mean by 2 bit withespace? Two whitespace characters?
If yes then I think that preserving the whitespaces depends on your stylesheet. For instance the following stylesheet will give you a copy of the input document as output and preserves the whitespaces:
Best Regards,
George
What do you mean by 2 bit withespace? Two whitespace characters?
If yes then I think that preserving the whitespaces depends on your stylesheet. For instance the following stylesheet will give you a copy of the input document as output and preserves the whitespaces:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
George
-
- Posts: 8
- Joined: Tue Feb 15, 2005 12:00 am
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Amey,
You cannot keep the whitespaces inside the attribute values when you transform a document using a stylesheet because the document is parsed before it gets to the transformer and in this process the XML processor will normalize the attribute values. See http://www.w3.org/TR/2004/REC-xml-20040204/#AVNormalize for more details.
Best Regards,
George
You cannot keep the whitespaces inside the attribute values when you transform a document using a stylesheet because the document is parsed before it gets to the transformer and in this process the XML processor will normalize the attribute values. See http://www.w3.org/TR/2004/REC-xml-20040204/#AVNormalize for more details.
Best Regards,
George
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Amey,
If you know what the data is supposed to be it *may* be possible, but in the general case you cannot do that as more white spaces (inclusing space, new lines, etc) are converted to a single space so you need additional information to change that space back to new lines, spaces or what was in your document.
If you have control on the input then use elements instead attributes to store that data.
Best Regards,
George
If you know what the data is supposed to be it *may* be possible, but in the general case you cannot do that as more white spaces (inclusing space, new lines, etc) are converted to a single space so you need additional information to change that space back to new lines, spaces or what was in your document.
If you have control on the input then use elements instead attributes to store that data.
Best Regards,
George
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service