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 December 13th, 2005, 09:23 AM
Registered User
 
Join Date: Dec 2005
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?

 
Old December 13th, 2005, 10:25 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 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





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





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