Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Problem with conversion

From: "Vasu Chakkera" <vasucv@----------->
To:
Date: 7/1/2002 1:59:00 AM
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: [xsl] 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


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