Subject: Re: [xsl] Find and change an attribute in a Processing Instruction From: "Rick Quatro" <frameexpert@xxxxxxxxxxxx> Date: Mon, 30 Jan 2006 13:47:51 -0500 |
<?xml version="1.0" encoding="UTF-8"?> <?Fm Condition Comment Red NO_OVERRIDE hide?> <?Fm Condition Prolog PANTONE%20648-50%20CVP NO_OVERRIDE show?> <?Fm Condition Internal Black DOUBLE_UNDERLINE hide?> <concept> <title>Sample Title</title> <?Fm Condstart Prolog?> <prolog><author>bernard</author></prolog> <?Fm Condend Prolog?> <conbody> <section><p>Some sample text.</p> <draft-comment author="Rick" importance="high"> <p>an author comment</p> </draft-comment> <?Fm Condend Comment?> <p>Some more sample text.</p> </section> </conbody> </concept>
<xsl:variable name="find" select="'hide'"/> <xsl:variable name="replace" select="'show'"/>
<xsl:template name="do-replace"> <xsl:param name="text"/> <xsl:choose> <xsl:when test="contains($text, $find)"> <xsl:value-of select="substring-before($text, $find)"/> <xsl:value-of select="$find"/> <xsl:call-template name="do-replace"> <xsl:with-param name="text" select="substring-after($text, $find)"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> </xsl:template>
<xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="/processing-instruction()"> <xsl:call-template name="do-replace"> <xsl:with-param name="text" select="."/> </xsl:call-template> </xsl:template>
<conbody> <section><p>Some sample text.</p> <draft-comment author="Rick" importance="high"> <p>an author comment</p> </draft-comment>
<p>Some more sample text.</p> </section> </conbody> </concept>
Rick Quatro Carmen Publishing 585-659-8267 www.frameexpert.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Find and change an attrib, David Carlisle | Thread | Re: [xsl] Find and change an attrib, Rick Quatro |
Re: [xsl] XPath problem, Jay Bryant | Date | Re: [xsl] Find and change an attrib, Rick Quatro |
Month |