Prevent XSL from processing entity references
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Mon Jan 11, 2010 3:56 pm
Prevent XSL from processing entity references
Post by ferguswood »
I am trying to make an identical copy of an XML and addinging in some additional nodes using XSL.
My problem is that the XSL transformation process is converting all my entity references in the source XML into the strings that exist in my DTD.
The result is that the modified output XML no longer contains entity references and my application therefore displays incorrect data. (my app does the conversion from entity ref to output string).
How can i prevent the transformation from processing the entity refs and outputting the associated strings?
For example:
In my DTD i have a number of ENTITY definitions where &phon032 becomes *phon032.
When I run my XSL transformation it substitutes the above XML into:
How can i make sure that my <xsl:copy-of statement sends the identical text to the output so that i have &phon.. instead of *phon.. in my outputted XML??
My problem is that the XSL transformation process is converting all my entity references in the source XML into the strings that exist in my DTD.
The result is that the modified output XML no longer contains entity references and my application therefore displays incorrect data. (my app does the conversion from entity ref to output string).
How can i prevent the transformation from processing the entity refs and outputting the associated strings?
For example:
Code: Select all
<desc lang="EN">This pronunciation activity practises the vowel sounds
/&phon032;/, /&phon003;/ and /&phon020;/. You choose the correct vowel sound
for each word.</desc>
In my DTD i have a number of ENTITY definitions where &phon032 becomes *phon032.
When I run my XSL transformation it substitutes the above XML into:
Code: Select all
<desc lang="EN">This pronunciation activity practises the vowel sounds
/*phon032;/, /*phon003;/ and /*phon020;/. You choose the correct vowel sound
for each word.</desc>
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Prevent XSL from processing entity references
Entities are not part of the XSLT data model, thus the XSLT processor sees only the replacement of the entity and not the entity itself so it is impossible to process that with XSLT. What you can do however is to add a pre-processing and a post-processing step that for example can convert entities to text and back to entities. For example you can have an entity like &sample; converted to &sample; in the pre-processing step and then back to &sample; in the post-processing step.
There are also more other limitations with XSLT identity transformation, you can find more information and solutions here
http://www.xmlplease.com/identity-template
Best Regards,
George
There are also more other limitations with XSLT identity transformation, you can find more information and solutions here
http://www.xmlplease.com/identity-template
Best Regards,
George
George Cristian Bina
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