Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 11th, 2006, 06:06 AM
Authorized User
 
Join Date: Oct 2005
Location: , , Philippines.
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.

Reply With Quote
  #2 (permalink)  
Old January 11th, 2006, 06:42 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
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
Reply With Quote
  #3 (permalink)  
Old January 11th, 2006, 11:42 PM
Authorized User
 
Join Date: Oct 2005
Location: , , Philippines.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok thanks.

Reply With Quote
  #4 (permalink)  
Old February 9th, 2006, 01:33 AM
Authorized User
 
Join Date: Oct 2005
Location: , , Philippines.
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.

Reply With Quote
  #5 (permalink)  
Old February 9th, 2006, 04:54 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
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
Reply With Quote
  #6 (permalink)  
Old February 12th, 2006, 11:14 PM
Authorized User
 
Join Date: Oct 2005
Location: , , Philippines.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i see, thank you very much.

Reply With Quote
  #7 (permalink)  
Old March 7th, 2006, 12:08 PM
Registered User
 
Join Date: Mar 2006
Location: Cleveland, OH, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.