[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to transfer xml to code by xslt?
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@t...> 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'; > } >
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|