[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xsl doesnt produce valid xhtml!!
Sorry, i dont think the attachments were working, ill paste them in: ----------------------------------------------------- examplexsl.xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" indent="yes" /> <xsl:variable name="Digits" select="1234567890"/> <xsl:template match="ves"> <html> <table> <xsl:apply-templates select="ve[not(contains(@pos, '.'))]" /> </table> </html> </xsl:template> <xsl:template match="ve"> <xsl:variable name="rowspan" select="@des" /> <xsl:choose> <!--TYPE--> <xsl:when test="entrydata/@colno='0'"> <!--<tr align="Left" valign="Top">-->TR<!--HEREHERE--> <td rowspan="{$rowspan}" bgColor="#FFFFC2" valign="Middle"> <xsl:choose> <xsl:when test="entrydata/text=''"> <B>-Uncategorised Type-</B> </xsl:when> <xsl:otherwise> <B><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></B> </xsl:otherwise> </xsl:choose> </td> </xsl:when> <!--RESPONSIBILITY, 1 dot--> <xsl:when test="entrydata/@colno='1'"> <xsl:choose> <xsl:when test="((count(../ve/@pos[string-length(translate(.,$Digits,'')) = 1])) > 1) and substring(current()/@pos, string-length(current()/@pos),'1') = 1"> <!--if count 1 dot elements > 1 and the last digit of the current element is 1 then dont put tr tag--> </xsl:when> <xsl:otherwise> <!--<tr align="left" valign="Top">-->TR<!--HEREHERE--> </xsl:otherwise> </xsl:choose> <td rowspan="{$rowspan}" bgcolor="#FFFFC2" valign="Middle"> <xsl:choose> <xsl:when test="entrydata/text=''"> <B>-Uncategorised Responsibility-<xsl:value-of select="@pos" /></B> </xsl:when> <xsl:otherwise> <B><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></B> </xsl:otherwise> </xsl:choose> </td> </xsl:when> <!--MISCELLANEOUS, 2 dots--> <xsl:when test="entrydata/@colno='2'"> <xsl:choose> <xsl:when test="((count(../ve/@pos[string-length(translate(.,$Digits,'')) = 2])) > 1) and substring(current()/@pos, string-length(current()/@pos),'1') = 1"> <!--if count 2 dot elements > 1 and the last digit of the current element is 1 then dont put tr tag--> </xsl:when> <xsl:otherwise> <!--<tr align="Left" valign="Top">-->TR<!--HEREHERE--> </xsl:otherwise> </xsl:choose> <td rowspan="{$rowspan}" bgcolor="#FFFFC2" valign="Middle"> <xsl:choose> <xsl:when test="entrydata/text=''"> <B>-Uncategorised Misc-<xsl:value-of select="@pos" /></B> </xsl:when> <xsl:otherwise> <B><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></B> </xsl:otherwise> </xsl:choose> </td> </xsl:when> <!--PROC, 3 dots--> <xsl:otherwise> <xsl:choose> <xsl:when test="((count(../ve/@pos[string-length(translate(.,$Digits,'')) = 3])) > 1) and substring(current()/@pos, string-length(current()/@pos),'1') = 1"> <!--if count 3 dot elements > 1 and the last digit of the current element is 1 then dont put tr tag--> </xsl:when> <xsl:otherwise> <!--<tr align="Left" valign="Top">-->TR<!--HEREHERE--> </xsl:otherwise> </xsl:choose> <!--proc name--> <td BgColor="#FFFFC2"><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></td> <!--proc owner--> <td BgColor="#FFFFC2"><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></td> <!--proc status--> <xsl:choose> <xsl:when test="entrydata[5]/text='Draft'"> <td BGColor="FF0000"><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></td> </xsl:when> <xsl:otherwise> <td BGColor="00FF00"><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></td> </xsl:otherwise> </xsl:choose> <!--proc ID number--> <td BgColor="#FFFFC2"><xsl:value-of select="entrydata/text" /><xsl:value-of select="@pos" /></td> <!--</tr>-->endTR<!--HEREHERE--> </xsl:otherwise> </xsl:choose> <!--loop through the viewentries by position--> <xsl:apply-templates select="../ve[starts-with(@pos, current()/@pos) and string-length(translate(@pos, $Digits, '' ) ) = 1 + string-length(translate(current()/@pos, $Digits, '' ) ) ]"> </xsl:apply-templates> </xsl:template> </xsl:stylesheet> ----------------------------------------------------------- examplexml.xml: <ves> <ve pos="1" des="4" siblings="2"> <entrydata colno="0" name="Type"> <text>Worldwide</text></entrydata> </ve> <ve pos="1.1" des="3"> <entrydata colno="1" name="Responsibilities"> <text>Implementation</text></entrydata> </ve> <ve pos="1.1.1" des="1"> <entrydata colno="2" name="MiscData"> <text>Unit controls</text></entrydata> </ve> <ve pos="1.1.1.1" siblings="1"> <entrydata colno="3" name="procName"> <text>Obtain version of anti-virus software</text></entrydata> <entrydata colno="4" name="procOwn"> <text>gale deve</text></entrydata> <entrydata colno="5" name="procPriority"> <text>4</text></entrydata> <entrydata colno="6" name="procPoints"> <text>hatfield, surrey</text></entrydata> <entrydata colno="7" name="procStatus"> <text>Live</text></entrydata> <entrydata colno="8" name="procID"> <text>uut-347</text></entrydata> </ve> <ve pos="1.1.2" des="2"> <entrydata colno="2" name="MiscData"> <text>Quality controls</text></entrydata> </ve> <ve pos="1.1.2.1" siblings="1"> <entrydata colno="3" name="procName"> <text>Check proc</text></entrydata> <entrydata colno="4" name="procOwn"> <text>bob dill</text></entrydata> <entrydata colno="5" name="procPriority"> <text>2</text></entrydata> <entrydata colno="6" name="procPoints"> <text>surrey</text></entrydata> <entrydata colno="7" name="procStatus"> <text>Live</text></entrydata> <entrydata colno="8" name="procID"> <text>eut-347</text></entrydata> </ve> <ve pos="1.1.2.2" siblings="1"> <entrydata colno="3" name="procName"> <text>Obtain ver</text></entrydata> <entrydata colno="4" name="procOwn"> <text>dave</text></entrydata> <entrydata colno="5" name="procPriority"> <text>5</text></entrydata> <entrydata colno="6" name="procPoints"> <text>hatfield</text></entrydata> <entrydata colno="7" name="procStatus"> <text>Live</text></entrydata> <entrydata colno="8" name="procID"> <text>urt-347</text></entrydata> </ve> <ve pos="1.2" des="1"> <entrydata colno="1" name="Responsibilities"> <text>Testing</text></entrydata> </ve> <ve pos="1.2.1" des="1"> <entrydata colno="2" name="MiscData"> <text>More controls</text></entrydata> </ve> <ve pos="1.2.1.1" siblings="1"> <entrydata colno="3" name="procName"> <text>Check tools available</text></entrydata> <entrydata colno="4" name="procOwn"> <text>gale deve</text></entrydata> <entrydata colno="5" name="procPriority"> <text>4</text></entrydata> <entrydata colno="6" name="procPoints"> <text>hatfield, surrey</text></entrydata> <entrydata colno="7" name="procStatus"> <text>Live</text></entrydata> <entrydata colno="8" name="procID"> <text>uut-347</text></entrydata> </ve> </ves> ------------------------------------------------------------ validoutput.html: <html> <table><tr><td rowspan="4" bgColor="#FFFFC2" valign="Middle"><B>Worldwide1</B></td> <td rowspan="3" bgcolor="#FFFFC2" valign="Middle"><B>Implementation1.1</B></td> <td rowspan="1" bgcolor="#FFFFC2" valign="Middle"><B>Unit controls1.1.1</B></td> <td BgColor="#FFFFC2">Obtain version of anti-virus software1.1.1.1</td> <td BgColor="#FFFFC2">Obtain version of anti-virus software1.1.1.1</td> <td BGColor="00FF00">Obtain version of anti-virus software1.1.1.1</td> <td BgColor="#FFFFC2">Obtain version of anti-virus software1.1.1.1</td></tr> <tr><td rowspan="2" bgcolor="#FFFFC2" valign="Middle"><B>Quality controls1.1.2</B></td> <td BgColor="#FFFFC2">Check proc1.1.2.1</td> <td BgColor="#FFFFC2">Check proc1.1.2.1</td> <td BGColor="00FF00">Check proc1.1.2.1</td> <td BgColor="#FFFFC2">Check proc1.1.2.1</td></tr> <tr><td BgColor="#FFFFC2">Obtain ver1.1.2.2</td> <td BgColor="#FFFFC2">Obtain ver1.1.2.2</td> <td BGColor="00FF00">Obtain ver1.1.2.2</td> <td BgColor="#FFFFC2">Obtain ver1.1.2.2</td></tr> <tr><td rowspan="1" bgcolor="#FFFFC2" valign="Middle"><B>Testing1.2</B></td> <td rowspan="1" bgcolor="#FFFFC2" valign="Middle"><B>More controls1.2.1</B></td> <td BgColor="#FFFFC2">Check tools available1.2.1.1</td> <td BgColor="#FFFFC2">Check tools available1.2.1.1</td> <td BGColor="00FF00">Check tools available1.2.1.1</td> <td BgColor="#FFFFC2">Check tools available1.2.1.1</td></tr></table> </html> --------------------------------------------------------------- output.html: <html> <table>TR<td rowspan="4" bgColor="#FFFFC2" valign="Middle"><B>Worldwide1</B></td> <td rowspan="3" bgcolor="#FFFFC2" valign="Middle"><B>Implementation1.1</B></td> <td rowspan="1" bgcolor="#FFFFC2" valign="Middle"><B>Unit controls1.1.1</B></td> <td BgColor="#FFFFC2">Obtain version of anti-virus software1.1.1.1</td> <td BgColor="#FFFFC2">Obtain version of anti-virus software1.1.1.1</td> <td BGColor="00FF00">Obtain version of anti-virus software1.1.1.1</td> <td BgColor="#FFFFC2">Obtain version of anti-virus software1.1.1.1</td>endTRTR<td rowspan="2" bgcolor="#FFFFC2" valign="Middle"><B>Quality controls1.1.2</B></td> <td BgColor="#FFFFC2">Check proc1.1.2.1</td> <td BgColor="#FFFFC2">Check proc1.1.2.1</td> <td BGColor="00FF00">Check proc1.1.2.1</td> <td BgColor="#FFFFC2">Check proc1.1.2.1</td>endTRTR<td BgColor="#FFFFC2">Obtain ver1.1.2.2</td> <td BgColor="#FFFFC2">Obtain ver1.1.2.2</td> <td BGColor="00FF00">Obtain ver1.1.2.2</td> <td BgColor="#FFFFC2">Obtain ver1.1.2.2</td>endTRTR<td rowspan="1" bgcolor="#FFFFC2" valign="Middle"><B>Testing1.2</B></td> <td rowspan="1" bgcolor="#FFFFC2" valign="Middle"><B>More controls1.2.1</B></td> <td BgColor="#FFFFC2">Check tools available1.2.1.1</td> <td BgColor="#FFFFC2">Check tools available1.2.1.1</td> <td BGColor="00FF00">Check tools available1.2.1.1</td> <td BgColor="#FFFFC2">Check tools available1.2.1.1</td>endTR</table> </html> -------------------------------------------------------------- From: "james walker" <jameswalkerandy@xxxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: xsl doesnt produce valid xhtml Date: Mon, 20 Oct 2003 13:22:14 +0100
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|