Subject: RE: [xsl] xsl:attribute problem From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Mon, 2 Dec 2002 12:06:21 -0000 |
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] 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><?php echo $email ?<</email> > > > I get this output: > > > <a href="mailto:<?php echo $email ?<"><?php echo $email > ?<</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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl:attribute problem, Jens Laufer | Thread | Re: [xsl] xsl:attribute problem, Jens Laufer |
[xsl] xsl:attribute problem, Jens Laufer | Date | RE: [xsl] xsl:attribute problem, Andrew Welch |
Month |