Re: [xsl] Find and change an attribute in a Processing Instruction

Subject: Re: [xsl] Find and change an attribute in a Processing Instruction
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 31 Jan 2006 12:36:28 GMT
> > <xsl:processing-instruction name="name()">

>   I'd use 'xsl:copy'.

No, that wouldn't work here. Like attributes and comments, processing
instructions don't have child nodes. The "text" of the processing
instruction is the value of the node itself, not the value of a child
text node as it would be with an element.

So if you use xsl;copy you copy the whole node, including its value, and
can not change the text inside.

By using <xsl:processing-instruction name="{name()}"> you generate a PI
with the same name as before but you are then free to apply string
replace templates to modify the PI text.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread