[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Parsing a string
Hi guys: I have a string like $select = SELECT * FROM aTable WHERE aColumn='something' ORDER BY anotherColumn and want to parse this to variables such fields = "*" from = "aTable" where = "aColumn='something' " order = "anotherColumn" so i made this: <xsl:attribute name="fields"> <xsl:value-of select="substring-before(substring-after($select,'SELECT'),'FROM')"/> </xsl:attribute> <xsl:attribute name="from"> <xsl:value-of select="substring-before(substring-after($select,'FROM'),'WHERE')"/> </xsl:attribute> <xsl:attribute name="where"> <xsl:value-of select="substring-before(substring-after($select,'WHERE'),'ORDER BY')"/> </xsl:attribute> <xsl:attribute name="order"> <xsl:value-of select="substring-after($select,'ORDER BY')"/> </xsl:attribute> This works, off-course, when $select is writen in that way, but if it is, for instance SELECT * FROM aTable ORDER BY anotherColumn SELECT * FROM aTable ORDER BY anotherColumn WHERE aColumn='something' and worst SELECT * FROM aTable WHERE aColumn=(SELECT aColumn FROM anotherTable WHERE anotherColumn='somethingelse') then it won't work. Of course i can put a lot of xsl:if and xsl:when, but hopefuly there's another way to do it. Someone has any ideia? O SAPO já está livre de vírus com a Panda Software, fique você também! Clique em: http://antivirus.sapo.pt
|
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
|