RE: Including http:// as value of href

Subject: RE: Including http:// as value of href
From: David Allouche <david@xxxxxxxxxxxxxxxx>
Date: Tue, 15 Aug 2000 22:56:18 -0200 (GMT+2)
On Mon, 14 Aug 2000, Joshua Allen wrote:

> Try <xsl:value-of select="concat('http://',.)" />

> > I would like to
> > directly insert 'http://' into the beginning of the value of 
> > HREF.  I would
> > appreciate any instance. [...]
> > XSL [,,,]
> >         <xsl:attribute name="HREF">
> >         http://<xsl:value-of select="."/>
> >      </xsl:attribute>
> > [...]
> > HTML Output
> > <A HREF="
> >";></A>

I find <value-of select="concat('string',XPath)"/> expression ugly -- just
my personal taste, inflenced by the default syntax hilighting in Emacs.

They can always be translated into something like:

  <xsl:text/>string<value-of select="XPath"/>


  <value-of select="XPath"/>

that in find more readable.

Whitespace handling in XSL/XML is a tricky issue.  What I keep I mind when
composing a stylesheet are the following rules:

1 - whitespace only nodes in the stylesheet are ignored
2 - any text node in the stylesheet that contains non-whitespace text is
    output literally
3 - use <xsl:text/> as a separator to put undesirable leading and trailing
    whitespaces in nodes of their own so that they are ignored
4 - when some leading/trailing whitespace is needed, use <xsl:text> with
    some content

In this case the attribute element in the stylesheet would become:

      <xsl:attribute name="href">
         <xsl:text/>http://<xsl:value-of select="."/>

                             -- David --

 XSL-List info and archive:

Current Thread