Subject: RE: xsl:attribute problem
From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx>
Date: Mon, 2 Dec 2002 14:51:26 -0000
|
> I just did like you suggested:
> With Xalan I get something like that:
> <a
> href="%0A%20%20%20%20%20%20%20mailto:%0A%20%20%20%20%20%20%20%
> 20<?php%20echo%20$email?>"><?php
> echo $email?></a>
> It seems that Xalan is doing an implicit URL encoding. Any
> idea to get rid of
> that?
Without seeing the source xml or the stylesheet that produced that
output I could only guess at what is happening...
...and I would guess that you have some presentational whitespace
creeping in from the template that produces it, something like:
<a>
<xsl:attribute name="href">
mailto:
<xsl:apply-templates select="email"/>
</xsl:attribute>
Which means there are a number of ways to solve this, with the best
being:
<a>
<xsl:attribute name="href">
<xsl:text/>mailto:<xsl:apply-templates select="email"/>
</xsl:attribute>
It would be easier if I didnt have to guess though - others simply wont
reply to an underspecified question.
cheers
andrew
> -----Original Message-----
> From: Jens Laufer [mailto:jens@xxxxxxxxxxxxxx]
> Sent: 02 December 2002 14:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: xsl:attribute problem
>
>
> Am Montag, 2. Dezember 2002 13:29 schrieb Andrew Welch:
> > You will need a named template, such as
> >
> > <xsl:template name="php">
> > <xsl:param name="value" select="'no param set'"/>
> > <xsl:text disable-output-escaping="yes"><?</xsl:text>
> > <xsl:value-of select="$value"/>
> > <xsl:text disable-output-escaping="yes">?></xsl:text>
> > </xsl:template>
> >
> > and then call the template using
> >
> > <xsl:call-template name="php">
> > <xsl:with-param name="value" select="something"/>
> > </xsl:call-template>
> >
> > whenever you want to output <? param text ?> etc...
> >
> > cheers
> > andrew
>
> Hi Andrew,
> thanks for your quick answer.
>
> I just did like you suggested:
> With Xalan I get something like that:
> <a
> href="%0A%20%20%20%20%20%20%20mailto:%0A%20%20%20%20%20%20%20%
> 20<?php%20echo%20$email?>"><?php
> echo $email?></a>
> It seems that Xalan is doing an implicit URL encoding. Any
> idea to get rid of
> that?
>
> With Resin (www.caucho.com) I get an error:
> ... attribute `href' outside element.
>
> regards,
> jens
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|