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 June 5th, 2008, 03:07 PM
Authorized User
Join Date: Jun 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unable to render the descriptor tag

Hello everyone.

My source document (simplified) is:

<?xml version= "1.0"?>
<?xml-stylesheet type= "text/xsl" href="file:///T:/custom/defaultss.xsl"?>
<Sent step="1">
<?xml version= "1.0" encoding="UTF-8"?><input_data><my_input_data>xyz</my_input_data>...</input_data>
<Expected step="1">
<?xml version= "1.0" encoding="UTF-8"?><expected_output_data><my_expected_data>123 </my_expected_data>...</expected_output_data>
<Actual step="1">
<?xml version= "1.0" encoding="UTF-8"?><real_output_data><the_real_data>123</the_real_data>...</real_output_data>

My current defaultss.xsl (which just highlights certain tags in the actual entry that do not match the expected) renders the XML, but for some reason all of the <?xml ver...?> tags after the first one are not being rendered. I'm guessing that I need to set up a template to handle them specifically. The actual rendering code works fine, I'm sure it's just a problem I don't understand with the template matching. I'm just not grasping what I need to modify in the following line to pick up the correct tag:

    <xsl:template match="processing-instruction()"> (this is the template that picks up the very first tag and correctly renders it)

I have tried
    <xsl:template match="*[processing-instruction()]"> (since it is a child)

    <xsl:template match="*[*[processing-instruction()]]"> (since they are actually 2 layers deep)

    <xsl:template match="*[*[*[processing-instruction()]]]"> (just for kicks)

but of course none have worked. Can someone point me in the right direction?

Old June 5th, 2008, 04:24 PM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

The reason you can't process them is that they are XML Declarations and there should be only one at the start of the document. It looks like someone has built a large document out of smaller ones but bypassed the XML model and just treated them as text files.


Joe (Microsoft MVP - XML)
Old June 5th, 2008, 04:27 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

Your source document is not well-formed. I'm amazed you can get it past the XML parser, it should be rejected long before it reaches the XSLT processor. An XML declaration can appear only at the start of the file, and a processing instruction cannog have the name "xml" (See section 2.6 of the XML rec, production rule 17).

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
deployment descriptor for weblogic g_basak EJB 3 June 25th, 2008 05:46 AM
Error assembling WAR: Deployment descriptor hendragd Spring 0 March 25th, 2008 10:16 AM
Detecting media descriptor wlangel CSS Cascading Style Sheets 0 August 22nd, 2006 03:05 PM
Unable to load tag handler class nithya123 BOOK: Professional Jakarta Struts 0 September 1st, 2005 10:02 AM
Unable connect to MySQL using JSTL tag PatrickWalsh JSP Basics 12 December 15th, 2004 01:41 PM

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