Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL and Whitespace

From: "Marrow" <marrow@---------.--.-->
To: NULL
Date: 11/1/2004 4:53:00 AM
Hi Tjerk,

The reason you are seeing whitespace in the attribute output is because you
are using implied output text.  As soon as you use implied output text -
that implied output text will also include any whitespace (inc. tabs, CRs
etc.).

You can overcome this by using explicit output text (and it's best to get
into the habit of using explicit output text), e.g.

<a>
   <xsl:attribute name="href">
    <xsl:value-of select="$absolute_url"/>
    <xsl:text>/index.php?page=</xsl:text>
    <xsl:value-of select="@page"/>
    <xsl:for-each select="page:var">
     <xsl:text>&amp;</xsl:text>
     <xsl:value-of select="page:name"/>
     <xsl:text>=</xsl:text>
     <xsl:value-of select="page:value"/>
    </xsl:for-each>
   </xsl:attribute>
 </a>

The ampersands are being correctly recognised and are being URL encoded
according to the HTML/XHTML specs.

HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator



"Tjerk Wolterink" <tjerk@w...> wrote in message
news:418387f6$0$76543$b83b6cc0@n......
> Hello all,
>
> how does xsl handle white space?
> I know you can set domething like this
> for nice indentation:
>
> <xsl:output method="xhtml" indent="yes"/>
>
> But know i have xsl code like this:
>
> <a>
>   <xsl:attribute name="href">
>    <xsl:value-of select="$absolute_url"/>/index.php?page=<xsl:value-of
> select="@page"/>
>    <xsl:for-each select="page:var">
>     &amp;<xsl:value-of select="page:name"/>=<xsl:value-of
> select="page:value"/>
>    </xsl:for-each>
>   </xsl:attribute>
> </a>
>
>
> But that should transform to someting like this:
>
> <a href="http://localhost/index.php?page=pages/medewerker.page.xml&id=42">
> </a>
>
> Not to someting like this:
>
> <a
>
href="http://localhost/index.php?page=pages/medewerker.page.xml%0a%09%09%09%
09&amp;%0a%09%09%09%09%09%09%09%09%09id%0a%09%09%09%09%09%09%09%09=42">
> </a>
>
>
> How do is solve my problem??
> And why is &amp not recognised? How should i define entities?
> Note, i have an xsd but i do not use it to validate documents, and the
> xml documents do not say wich scheme they are. So how can i define &amp;
> =& without xsd?!?!




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent