![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XSL and Whitespace >Thread Next - Re: XSL and Whitespace Re: XSL and WhitespaceTo: 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>&</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">
> &<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&%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 & 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 &
> =& without xsd?!?!
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
