Subject: RE: Eliminating CR in a text output From: "Chris Bayes" <Chris@xxxxxxxxxxx> Date: Tue, 12 Sep 2000 15:39:24 +0100 |
Paul, Maybe that is overkill I think that <xsl:template match="ht"> <xsl:value-of select="normalise-space()" /> </xsl:template> would do it. I just copied it from a stylesheet that does javascript stuff that i did a while ago. The following will probably come in handy if you have quotes in your <ht> elements <xsl:template name="cleanQuote"> <xsl:param name="string" /> <xsl:if test="contains($string, '"')"><xsl:value-of select="substring-before($string, '"')" />\"<xsl:call-template name="cleanQuote"> <xsl:with-param name="string"><xsl:value-of select="substring-after($string, '"')" /> </xsl:with-param> </xsl:call-template> </xsl:if> <xsl:if test="not(contains($string, '"'))"><xsl:value-of select="$string" /> </xsl:if> </xsl:template> called in a similar way. Ciao Chris XML/XSL Portal http://www.bayes.co.uk/xml >-----Original Message----- >From: owner-xsl-list@xxxxxxxxxxxxxxxx >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Chris Bayes >Sent: 12 September 2000 15:11 >To: xsl-list@xxxxxxxxxxxxxxxx >Subject: RE: Eliminating CR in a text output > > >Paul, >Try this > ><xsl:template match="ht"> > <xsl:variable name="noLF"><xsl:call-template >name="cleanLF"><xsl:with-param name="string"><xsl:value-of >select="." /></xsl:with-param></xsl:call-template></xsl:variable> ><xsl:value-of >select="$noLF" /> ></xsl:template> > >or this > ><xsl:template match="ht"> > <xsl:call-template >name="cleanLF"><xsl:with-param name="string"><xsl:value-of >select="." /></xsl:with-param></xsl:call-template> ></xsl:template> > >with this > ><xsl:template name="cleanLF"> ><xsl:param name="string" /> ><xsl:if test="contains($string, '
')"><xsl:value-of > select="substring-before($string, '
')" /> > <xsl:call-template name="cleanLF"><xsl:with-param > name="string"><xsl:value-of >select="substring-after($string, '
')" >/></xsl:with-param> > </xsl:call-template> ></xsl:if> ><xsl:if test="not(contains($string, '
'))"><xsl:value-of >select="$string" /> ></xsl:if> ></xsl:template> > >Ciao Chris > >XML/XSL Portal >http://www.bayes.co.uk/xml > > >>-----Original Message----- >>From: owner-xsl-list@xxxxxxxxxxxxxxxx >>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Paul Terray >>Sent: 12 September 2000 13:11 >>To: xsl-list@xxxxxxxxxxxxxxxx >>Subject: Eliminating CR in a text output >> >> >>I'm sorry this surely has been treated before, but I didn't find anything >>in the archives (missing the good keyword, probably): >> >>I want to transform some XML into some text (Javascript, namely). What I >>want is to use some of the XML->HTML templates I already wrote. >>However, it >>seems the CR found in my XML source arrive in my final text (what >>javascript does not like at all). >> >>For example, my xml is like this : >><h4 function="high"><ht>Présentation - >>Fonctions</ht> >> >>And what I want to get is : >>"Présentation - Fonctions" >>(with no CR in the middle of my title) >> >>I tried a <xsl:strip-space elements="ht"/> but it only works with a CR >>before the </ht>. >> >>I work with Oracle parser and processor. >> >>Thanks in advance. >>-- >>Paul Terray - terray@xxxxxxxxxxxx >>tel : 01 34 58 70 76 >> >> >> >> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Eliminating CR in a text output, Chris Bayes | Thread | RE: Eliminating CR in a text output, Oliver Becker |
RE: Eliminating CR in a text output, Chris Bayes | Date | Re: XSLT Engine for Linux, John Robert Gardner |
Month |