Altova Mailing List Archives>Archive Index >xml-dev Archive Home >Recent entries >Thread Prev - How to transfer xml to code by xslt? [Thread Next] Re: [xml-dev] How to transfer xml to code by xslt?To: LUKE <luke@--.-------.---.--> Date: 4/3/2006 4:12:00 AM 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'; > } > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
