[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xml cells transformed in to a 2-d table, some tabl
Hi Michael, Thank-you for both of your responses very informative. > Now for some reason you have chosen to use XSLT 1.0 rather than XSLT 2.0. > That makes the problem no fun at all. If you really have to use XSLT 1.0, Unfortunately I can not find a python library to support XSLT 2.0. The library I am using only supports 1.0. I have written a large chunk of code already so I have to stay with 1.0 only for now. > <xsl:variable name="ig" select="$doc//intergreen[from = $x and to = > $y]"/> When using XSLT 1.0 I got various error messages with the above syntax. XPath error : Invalid expression if (exists($ig)) then $ig/length else 0 ^ Just using the exists statement I got:- xmlXPathCompOpEval: function exists not found However I managed to work around this by looking at the string-length. Working solution:- <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <tt> <i> </i> <xsl:for-each select="//traffic_signals/site/phases/phase"> <i> <xsl:value-of select="letter" /> </i> </xsl:for-each> <i>  </i> <xsl:for-each select="//traffic_signals/site/phases/phase"> <xsl:variable name="row" select="letter"/> <i><xsl:value-of select="letter" /></i> <xsl:for-each select="//traffic_signals/site/phases/phase"> <xsl:variable name="col" select="letter"/> <xsl:variable name="ig" select="//traffic_signals/site/intergreens/intergreen[from=$row and to=$col]/length"/> <xsl:if test="string-length($ig) > 1" > <b><xsl:value-of select="$ig" /> </b> </xsl:if> <xsl:if test="string-length($ig) > 0" > <b> <xsl:value-of select="$ig" /> </b> </xsl:if> <xsl:if test="string-length($ig) < 1" > <xsl:if test="$row = $col" > <b> X </b> </xsl:if> <xsl:if test="$row != $col" > <b> - </b> </xsl:if> </xsl:if> </xsl:for-each> <i>  </i> </xsl:for-each> </tt> </xsl:template> </xsl:stylesheet> Thanks for the help and feedback. Regards, Brendan M. Sleight
|
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
|