Subject: Re: [xsl] Find and change an attribute in a Processing Instruction From: Jon Gorman <jonathan.gorman@xxxxxxxxx> Date: Mon, 30 Jan 2006 13:30:24 -0600 |
> 1) The "hide" strings in the processing instructions are not being replaced > by "show". <xsl:when test="contains($text, $find)"> <xsl:value-of select="substring-before($text, $find)"/> <xsl:value-of select="$find"/> ... and so on So this part of your code gets everything before the occurance of $find, returns that. Then it returns the value of $find. It keeps doing this while there is still a string (I hope, otherwise it won't terminate). It might work better to have something like: <xsl:when test="contains($text, $find)"> <xsl:value-of select="substring-before($text, $find)"/> <xsl:value-of select="$replace"/> ..and so on which would return all the text before the first occurance of $find, the the value of $replace, and then do a recursive call on the rest of the string (everything after the first occurance of $find). > 2) I am loosing the <? ?> delimiters on the processing instructions. As far as I can tell you're not "losing them", you never create a new processing instruction. Your stylesheet essentially says: when you see a processing instruction, generate this text. I've only skimmed your email, but I would venture you need something like: <xsl:template match="/processing-instruction()"> <xsl:processing-instruction> <xsl:call-template name="do-replace"> <xsl:with-param name="text" select="."/> </xsl:call-template> </xsl:processing-instruction> </xsl:template> Or in other words: when you see a processing instruction in the input XML, produce a processing instruction that contains the results of the call-template. > 3) Lower level processing instructions are not getting written to the output > (e.g. <?Fm Condstart Prolog?>). Just got an email you figured out what's wrong there. > I am using Saxon 8.5, but my stylesheet needs to be XSLT 1 compatible. > Thanks in advance for any help you can give. So why not use Saxon 6.5? Besides, this looks XSLT 1ish to me. Jon Gorman
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Find and change an attrib, Rick Quatro | Thread | Re: [xsl] Find and change an attrib, Rick Quatro |
RE: [xsl] selecting into an include, Michael Kay | Date | Re: [xsl] Find and change an attrib, Rick Quatro |
Month |