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 May 12th, 2006, 01:26 AM
Authorized User
 
Join Date: Apr 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vakorde
Default Processing Instructions Templates.

 Hi Frnz,

I need help in the conext of processing instructions.
the element that i have as a prcessing instructions is having the XML code in it. and now i want to process that value. i.e. apply-templates.....

Here is the code

<?xm-deletion author="procs" time="20010713T180850-1820"
data="&lt;elephant:Billva id=&quot;id_BC98D89B-2502-4225-&quot;
xmlns:elephant=&quot;http:gogle.comelephant.1#&quo t;
xmlnshtml=&quot;http://www.w3.org/1999/xhtml&quot;
xmlnslink=&quot;http://www.w3.org/1999/xlink&quot;&...ant:Num&gt;SEC.
10.&lt;/elephant:Num&gt;&lt;elephant:ActionLine action=&quot;IS_AMENDED&quot;
xlink:href=&quot;urn:elephant:codes:EDC:elephant#x pointer(%2Felephant%3AJokeDoc%2
Felephant%3ACode%2Felephant%3AJokeHeading%5B%40typ e%3D....."?>

In this code i could get the value of the data attribute
The next problem was to remove the &lt; and &gt; that was solved by a replace function.
The actual problem that i am faing now is that i need to again do something like <apply-temlates select="$variable"/> The reason behind is that the value of the data is nothing but a element of the XML itself. Can i give this input to the apply templates so that the templates which i have already written will get applied to this value?

Please help me in this matter.

Thanks in advance.

---------------------------
Vikrant Korde
3i Infotech, Vashi,
Mumbai, Maharashtra, India.
__________________
---------------------------
Vikrant Korde
3i Infotech, Vashi,
Mumbai, Maharashtra, India.
 
Old May 12th, 2006, 03:41 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to extract the text of the processing instruction and pass it to an XML parser. It's actually worse than it looks, because it's double-escaped: the string value of the processing instruction is not <elephant>...</elephant>, but &lt;elephant&gt;....&lt;/elephant&gt; (because entity references are not recognized as such in processing instructions). You'll probably have to solve that with a bit of string manipulation code.

If you're using Saxon, you could use replace() to do the unescaping, and then call saxon:parse to turn the lexical XML into a tree structure that your XSLT code can process.

At the same time you might have a word with the people who generated this stuff and ask them why they can't use XML the way it was designed to be used.

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
Newby - Download Instructions bill.mccullen BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 December 1st, 2008 09:36 AM
Chapter 2 Unable to follow instructions GarethHowell BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 4 July 9th, 2008 03:49 AM
Working / revised set up instructions ? HSCIII BOOK: ASP.NET Website Programming Problem-Design-Solution 0 January 31st, 2004 11:41 PM





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