[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problem with <a> conversion

Subject: Re: Problem with <a> conversion
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Mon, 01 Jul 2002 09:58:35 +0000
php url conversion
If you are trying to get hold of the all the a elements in the xml document irrespective of where or under which element they appear ,you can use //a instead of the a under each of the elements..
and you have to then concatinate the href attribute of each of these a elements to the PHP URL you have..that is..
"Php-url"+@xxxxxx


The following code would help you.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="//a">
<xsl:variable name="url" select="concat('http://localhost/ashu/transform.php?url=',@href)"/>
<a href="{$url}"><xsl:value-of select="$url"/></a><br/>
</xsl:template>
</xsl:stylesheet>


HTH
Vasu

From: "ashu  t" <aashut@xxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Problem with <a>  conversion Date: 1 Jul 2002 09:18:58 -0000

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>


<xsl:template match="a">
<p> <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>
</p>
</xsl:template>


and my php program transform.php for conversion is
<?php
header("Content-type:text/vnd.wap.wml");
echo("<?xml version=\"1.0\"?>");
echo("<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.2//EN'
'http://www.wapforum.org/DTD/wml_1.2.xml'>");
$th=xslt_create();
$result=xslt_process($th,$url,'myprogram.xsl');
if (!$result)
{
die(sprintf("Cannot process XSLT document [%d]: %s",
xslt_errno($xh), xslt_error($xh)));
}
print "$result";
xslt_free($th);
?>
$url is the name of html file passed to this transform.php program from the first program which just ask ENTER THE URL::
and send that url to this php program for conversion.
what is the correct way to do that.
ashu t
_________________________________________________________
There is always a better job for you at Monsterindia.com.
Go now http://monsterindia.com/rediffin/



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.