Subject: Re: Normalize-Space for a template
From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx>
Date: Fri, 2 May 2003 12:34:35 -0700
|
In your example, I didn't see where you performed an "normalization" of
white space. Is that because with this approach, it is not necessary?
----- Original Message -----
From: <me@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, May 02, 2003 11:36 AM
Subject: Re: Normalize-Space for a template
> > Hello,
> > The following template create a URL. One or more line
> > returns occur in the
> > source as well unwanted spaces. I'm trying to figure
> > out how to use
> > "normalize-space" to strip these unwanted spaces.
> Here
> > is what I have
> > tried:
> >
> > <xsl:template name="makeUrl">
> > <xsl:param name="Display"/>
> > <xsl:param name="url"/>
> > <xsl:param name="Query"/>
> > <a>
> > <xsl:attribute name="href">
> > <xsl:value-of select="$url"/>&
> > <xsl:value-of select="$Query"/>
> > </xsl:attribute>
> > <xsl:value-of select="$Display"/>
> > </a>
> >
> > <!-- NORMALIZE THIS STUFF -->
> > <xsl:value-of select='normalize-space(.)'/>
> >
> > </xsl:template>
> >
> >
> > It doesn't work. Any ideas?
> > Karl
> Normalize-space is a function just like any other
> language. You have to pass in what you want it to work
> on. The part you want to fix the spaces on is not being
> passed into the normalize-space function (the . is
> looking in the XML input not the <a> right above)
>
> You could try a different approach:
>
> <?xml version="1.0" encoding="utf-8"?>
> <!--
> Author:
> File:
> Date:
> Purpose:
> -->
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes"
> encoding="UTF-8"/>
>
> <xsl:template match="/">
> <xsl:call-template name="makeUrl">
> <xsl:with-param name="Display" select="'foo'"/>
> <xsl:with-param name="url"
> select="'http://bar.com'"/>
> <xsl:with-param name="Query" select="'?hu=ok'"/>
> </xsl:call-template>
> </xsl:template>
>
> <xsl:template name="makeUrl">
> <xsl:param name="Display"/>
> <xsl:param name="url"/>
> <xsl:param name="Query"/>
>
> <xsl:variable name="fullURI">
> <xsl:value-of select="$url"/>&<xsl:value-of
> select="$Query"/>
> </xsl:variable>
> <!-- <a>
> <xsl:attribute name="href">
> <xsl:value-of select="$url"/>&
> <xsl:value-of select="$Query"/>
> </xsl:attribute>
> <xsl:value-of select="$Display"/>
> </a> -->
> <a>
> <xsl:attribute name="href">
> <xsl:value-of select="$fullURI"/>
> </xsl:attribute>
> <xsl:value-of select="$Display"/>
> </a>
> <!-- NORMALIZE THIS STUFF -->
> <!-- <xsl:value-of select='normalize-space(.)'/> -->
> </xsl:template>
>
> </xsl:stylesheet>
>
> _/ _/_/ _/_/_/
> _/_/ _/ _/ _/
> _/ _/
> _/ _/
> _/ _/_/_/_/
> http://treebeard.sourceforge.net
> http://ashpool.sourceforge.net
>
> 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 |
me - Fri, 2 May 2003 14:36:45 -0400 (EDT)
- Karl J. Stubsjoen - Fri, 2 May 2003 15:33:04 -0400 (EDT) <=
me - Fri, 2 May 2003 16:17:24 -0400 (EDT)
Passin, Tom - Fri, 2 May 2003 17:00:46 -0400 (EDT)
|
|