![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >xsl-list Archive Home >Recent entries >Thread Prev - [xsl] Problem with conversion [Thread Next] Re: [xsl] Problem with conversionTo: Date: 7/1/2002 1:43:00 AM Hi Ashu,
> i am trying to convert html to wml using xslt. when there is <a> tag
> in html i am trying to fetch the href of that and send that to my
> php program which is using xslt to convert it into wml.but it is
> giving error.
> i tried
> <xsl:template match="div/a | center/a | p/a | ul/a | li/a | tr/a
> | td/a | th/a | table/a | font/a">
> <xsl:variable name="url">
> <xsl:value-of select="@href"/>
> </xsl:variable>
> <a
> href="http://localhost/ashu/transform.php?url=@href">
> <xsl:value-of select="."/></a>
> </xsl:template>
What you're creating here are a elements like:
<a href="http://localhost/ashu/transform.php?url=@href">
...
</a>
In other words, the value of the url parameter passed to your
transform.php script is always the literal string '@href'. You want to
pass the *value* of the 'href' attribute instead, so use {}s around
the '@href' as follows:
<xsl:template match="a">
<a href="http://localhost/ashu/transform.php?url={@href}">
<xsl:apply-templates />
</a>
</xsl:template>
(BTW, it's a good idea to use xsl:apply-templates rather than
xsl:value-of in the content of the a element in case the a element
contains other markup.)
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
