|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with <a> conversion
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








