|
Subject: RE: [xsl] xsl:attribute problem From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx> Date: Mon, 2 Dec 2002 12:29:51 -0000 |
You will need a named template, such as
<xsl:template name="php">
<xsl:param name="value" select="'no param set'"/>
<xsl:text disable-output-escaping="yes"><?</xsl:text>
<xsl:value-of select="$value"/>
<xsl:text disable-output-escaping="yes">?></xsl:text>
</xsl:template>
and then call the template using
<xsl:call-template name="php">
<xsl:with-param name="value" select="something"/>
</xsl:call-template>
whenever you want to output <? param text ?> etc...
cheers
andrew
> -----Original Message-----
> From: Jens Laufer [mailto:jens@xxxxxxxxxxxxxx]
> 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 -> |
|---|---|---|
| RE: [xsl] xsl:attribute problem, Michael Kay | Thread | Re: [xsl] xsl:attribute problem, Jens Laufer |
| RE: [xsl] xsl:attribute problem, Michael Kay | Date | [xsl] seeking clarification on node, Zakon, Stuart |
| Month |