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 January 11th, 2006, 06:06 AM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default preserving entity references

when the source file has entity references and an xsl file has process it, these entities are converted to its actual character.
is there a way to preserve this? thanks.

 
Old January 11th, 2006, 06:42 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

No, there's no way to prevent this.

The workaround people sometimes use is to edit the file before transformation to replace all & characters by, say, ¶, and then edit the pilcrows back to ampersands after the transformation.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 11th, 2006, 11:42 PM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok thanks.

 
Old February 9th, 2006, 01:33 AM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i was going to used this approach but then again, it came to my mind that i actually need those entity reference because i am comaparing strings in my transformation. is there another way? or an application that can probably search and replace the entities? thanks.

 
Old February 9th, 2006, 04:54 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Another possibility is to replace an entity reference &ent; with a construct such as

<?ent-start ent?>&ent;<?ent-end ent?>

If your transformation preserves the processing instructions, then a post-processing phase could reinstate the entity reference.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 12th, 2006, 11:14 PM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i see, thank you very much.

 
Old March 7th, 2006, 12:08 PM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mhkay
 Another possibility is to replace an entity reference &ent; with a construct such as

<?ent-start ent?>&ent;<?ent-end ent?>

If your transformation preserves the processing instructions, then a post-processing phase could reinstate the entity reference.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
I've been fighting the same problem the last few days. I see your work-around is superior to mine. I've been trying to come up with all the pattern combinations to edit the output of the parser back.

Is there any point in suggesting a parser have the option to preserve entity references, rather than translating them? I am using Access to export a straightforward table as XML and using XSLT to do the final XML with attributes properly assigned to elements. Or is the problem that once the "value-of select..." result returns, the parsing is too far advanced to make this translation?

Harlan R. Cohen, MBA, CPIM





Similar Threads
Thread Thread Starter Forum Replies Last Post
Preserving DataTypes in DTS execution hemanth_p2p SQL Server DTS 9 December 15th, 2005 12:35 AM
Entity References and DOM boemane C# 0 August 24th, 2004 08:21 AM
Difference between Entity and Entity type arshad mahmood C++ Programming 0 May 8th, 2004 12:34 AM
preserving entity references using DOM, JAXP srivalli9 XML 2 November 17th, 2003 11:00 AM
entity references not preserved in XML Output srivalli9 J2EE 0 November 14th, 2003 05:29 PM





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