Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
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 Display Modes
  #1 (permalink)  
Old December 13th, 2005, 08: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"?>
<doc>
    <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>
</doc>

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, 09:25 AM
mhkay's Avatar
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts
Default

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
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools
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 06:31 AM
Escape ' lafilip XSLT 3 May 22nd, 2007 03:31 AM
escape squences in C# kapi.goel C# 7 January 10th, 2006 09:24 AM
Escape char for '-' mattastic Access 1 October 6th, 2005 03:27 PM



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


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