[
Lists Home |
Date Index |
Thread Index
]
The list for asking XSLT questions is
http://www.mulberrytech.com/xsl/xsl-list/index.html.
The stylesheet for this problem is
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" />
<xsl:template match="/logic">
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="not(self::execute-query)">
<xsl:value-of select="." />
</xsl:when>
<xsl:otherwise>
$sql='<xsl:value-of select="normalize-space()" />';
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Regards,
Mukul
On 4/3/06, LUKE <luke@tc.program.com.tw> wrote:
>
> XML Document:
>
> <logic>
> if ($a==1){
> <execute-query>
> <![CDATA[
> SELECT * FROM address WHERE id =$CGI_paraname
> ]]>
> </execute-query>
> }else{
> <execute-query>
> <![CDATA[
> SELECT * FROM address2 WHERE id =$CGI_paraname
> ]]>
> </execute-query>
> }
> </logic>
>
> I want to transfer to using *.xsl.
>
> if ($a==1){
> $sql='SELECT * FROM address WHERE id =$CGI_paraname';
> }else{
> $sql='SELECT * FROM address2 WHERE id =$CGI_paraname';
> }
>
|