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 | 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 May 12th, 2006, 01:26 AM
Authorized User
Join Date: Apr 2006
Location: NaviMumbai, Maharashtra, India.
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;
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.
Reply With Quote
  #2 (permalink)  
Old May 12th, 2006, 03:41 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

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
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
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

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

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