Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 13th, 2005, 09:23 AM
Registered User
Join Date: Dec 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default un escape text to use as fragment

I have this xml

<?xml version="1.0" encoding="UTF-8"?>
    <INDXES> &lt;indexes&gt;&lt;scro_number&gt;S29811/94Q&lt;/scro_number&gt; &lt;subject_surname&gt;DICKIE&lt;/subject_surname&gt;&lt;keywords&gt;DICKIE&lt;/keywords&gt;&lt;case_number&gt;BA05001553&lt;/case_number&gt;&lt;office_code&gt;BA&lt;/office_code&gt;&lt;date_of_receipt&gt;2005-10-07&lt;/date_of_receipt&gt;&lt;witness_seq_no&gt;1&lt;/witness_seq_no&gt;&lt;/indexes&gt;</INDXES>

as the text between <INDXES></INDXES> is valid xml with the angle brackets encoded it should be possible to use the un-encoded text as a node or node fragment.
Assigning the value to a variable with disable-output-escaping="yes" doesn't seem to work.

Can anyone help?

Reply With Quote
  #2 (permalink)  
Old December 13th, 2005, 10:25 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: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

The best advice is to avoid getting into this mess in the first place. The idea of &lt; and &gt; is that they should be used for escaping angle brackets that aren't being used for markup; if you use them for angle brackets that *do* represent markup then you're creating problems for yourself.

By "unescaping" you actually mean parsing. You need to pass the string (the content of the INDXES element) to an XML parser to construct a tree. In Saxon you can do this with the saxon:parse() extension; in other processors you can do it with your own extension function.

Another solution is to serialize the whole document, using disable-output-escaping="yes" for the relevant text node, and then reparse the whole thing.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote

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
for-each on result tree fragment RoeZ XSLT 11 November 22nd, 2007 07:31 AM
Escape ' lafilip XSLT 3 May 22nd, 2007 03:31 AM
escape squences in C# kapi.goel C# 7 January 10th, 2006 10:24 AM
Escape char for '-' mattastic Access 1 October 6th, 2005 03:27 PM

All times are GMT -4. The time now is 12:44 AM.

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