Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Problem with conversion

From: Jeni Tennison <jeni@---------------->
To:
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


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