Subject: Re: [xsl] Problem with <a> conversion From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 1 Jul 2002 10:42:57 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Problem with <a> conversion, ashu t | Thread | [xsl] include problem, shaik |
[xsl] include problem, shaik | Date | Re: [xsl] Problem with <a> conversi, Vasu Chakkera |
Month |