HTML and javascript in XSL style sheet

admin

Administrator
Staff member
I produce a HTML output from an XSL stylesheet, and the format I write thestylesheet is to have normal html, with the XSL tags handling items suchas table rows for the XML data, in between.eg.<html><head></head><body><p> My Table </p><table><xsl:for-each select="data"><tr><td><xsl:value-of select="Name"/></td></tr></xsl:foreach></table></body></html>I have written a form in a similar way, and have a bit of javascript at thebottom, but am annoyed by the syntax being incorrect for things like '&'and '<'. One solution is to use<xsl:text disable-output-escaping="yes">&</xsl:text>but this is really annoying when I have javascript expressions generatedfor each table data like :<xsl:for-each select="data">if((field1 != "<xsl:value-of select="Name"/>" <xsl:text disable-output-escaping="yes">&&</xsl:text>field2=="")||(field3 < "10" <xsl:text disable-output-escaping="yes">&&</xsl:text>field4 >"100"))</xsl:for-each>because everytime there is an '&' or '<', I have to use the above escapetag, ending up with a lot of unreadable source.Is there a better way to do this ?Thanks,Eric
 
Back
Top