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 March 7th, 2006, 09:21 AM
Authorized User
 
Join Date: Dec 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default Need to pick up a declaration from a node

Here we go!..
I have an input xml wherein a tag holds a declaration.
[u]ie</u>
<TestTemplate><?BTW_B2B_OnRamp_Test_Id bcRequestOrder?B2B_OR_bcRequestOrder_SMPFDIFFCP_OR DREJMIGSMPFDIFFCP?></TestTemplate>

I need to pick this declaration and have it at the top of my output xml, beneath the xml declaration.

If the TestTemplate holds only a string i'm able to make this happen with the xsl:processing-instruction.;)
But as the TestTemplate holds the complete declaration....i'm experiencing trouble in picking the complete declaration.

Is there a way u guyz can help me do it?

Thanx in advance,
Ramesh

__________________
Ramesh
\"Always Look For Something NEW\"
 
Old March 7th, 2006, 10:00 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's not a declaration, it's a processing instruction; and it's not in a tag, it's between two tags (a start tag and an end tag).

You can use xsl:copy-of to copy the processing instruction. Something like

<xsl:template match="/">
  <xsl:copy-of select="//TestTemplate/processing-instruction::*"/>
  <doc>
    ,,,
  </doc>
</xsl:template>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 7th, 2006, 10:04 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sorry, that was nonsense. When I wrote

<xsl:copy-of select="//TestTemplate/processing-instruction::*"/>

I meant

<xsl:copy-of select="//TestTemplate/processing-instruction()"/>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 8th, 2006, 12:40 AM
Authorized User
 
Join Date: Dec 2005
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

Hey man!
Thanx a lot. Never thought i would get a quick and a prompt reply.
Thanx again,
ramesh






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to append child node after an node in XML + C# vishnu108mishra XML 5 November 13th, 2007 05:30 AM
Does anyone know a way i can pick out only numbers crmpicco Perl 2 March 15th, 2007 08:57 AM
Copying Source Node attributes to output node pvsat XSLT 2 November 3rd, 2005 09:46 AM
pick text apart darkhalf Beginning PHP 7 March 12th, 2004 04:15 PM





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