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

RE: xsl:attribute problem

Subject: RE: xsl:attribute problem
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 2 Dec 2002 12:06:21 -0000
a href mailto a
The output you are trying to achieve is not well-formed HTML, so the
only way you can construct it with the HTML output method is to use
disable-output-escaping.

The <?---?> thing is not a processing instruction (because PIs can't
occur inside attributes); if it were a PI, you would create it using
xsl:processing-instruction, not xsl:pi.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Jens Laufer
> Sent: 02 December 2002 10:58
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  xsl:attribute problem
> 
> 
> Hi all,
> I need to solve this problem:
> I want to create this output from a XML-source and a XSL-stylesheet:
> 
> 
> <---snippet---!>
> <a href="mailto: <?php echo $email?>"><?php echo $email?></a> 
> <---snippet---!>
> 
> 
> I am using this XSL-stylesheet:
> <---snippet---!>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> version="1.0">
> 
> 
>   <xsl:output method="html" indent="yes"/>
> 
> 
>   <xsl:template match="/document">
>      <a>
>       <xsl:attribute name="href">mailto:<xsl:apply-templates 
> select="email"/></xsl:attribute>
>       <xsl:apply-templates select="email"/>
>      </a>
>   </xsl:template>
> 
> 
>  <xsl:template match='email'>
>   <xsl:apply-templates/>
>  </xsl:template>
> 
> 
>  <xsl:template match='*|@*'>
>     <xsl:copy>
>         <xsl:apply-templates select='node()|@*'/>
>     </xsl:copy>
>  </xsl:template>
> 
> 
> </xsl:stylesheet>
> <---snippet---!>
> 
> 
> I tried this XML to get that output: 
> ======================================================================
> XML:
> 
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <document>
>   <email><xsl:pi value="php">echo $email</xsl:pi></email> </document>
> 
> 
> 
> I get this error:
> java.io.IOException: /home/jens/test/test.xsl:7: element 
> `xsl:pi' is not 
> allowed inside attribute `href'.
> 
> 
> ================================================================
> XML:
> 
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <document>
>   <email><script language="php">echo $email</script></email> 
> </document>
> 
> 
> I get this error:
> java.io.IOException: /home/jens/test/test.xsl:7: element 
> `script' is not 
> allowed inside attribute `href'.
> 
> 
> =================================================================
> XML:
> 
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <document>
>   <email><?php echo $email ?></email>
> </document>
> 
> 
> I get this output:
> 
> 
> <a href="mailto:";></a>
> 
> 
> =================================================================
> XML:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <document>
>   <email>&lt;?php echo $email ?&lt;</email>
> 
> 
> I get this output:
> 
> 
> <a href="mailto:<?php echo $email ?&lt;">&lt;?php echo $email 
> ?&lt;</a> 
> ==================================================================
> I don't really know how to solve that and I am struggling 
> around with it since  
> a while now...
> 
> 
> Actually I don't want to change the stylesheet too much, 
> because with the 
> current stylesheet it should be possible to swap quickly 
> technologies: You just change e.g. <?php echo $test?> into 
> <%=test%> and you can use jsp... So there should be no 
> "technologiy" infromation in the stylesheet.
> 
> 
> I think especially the attributes are making a lot of 
> problems... Any ideas? Thanks in advance! Jens
> 
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 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.