OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] How to transfer xml to code by xslt?

[ 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';
> }
>




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS