Re: SV: [xsl] xsl doesnt produce valid xhtml

Subject: Re: SV: [xsl] xsl doesnt produce valid xhtml
From: "james walker" <jameswalkerandy@xxxxxxxxxxx>
Date: Tue, 21 Oct 2003 13:28:24 +0100
I did this but it still isnt working, xtrans complains that the <tr> tag doesnt match the <xsl:when> tag, in other words its looking for the closing tag but not finding anything. I have tested it replacing teh tr tags for letter TR and the test produces valid xhtml???:

?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="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>--></tr><!--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>



From: "Thomas V. Nielsen" <verakso@xxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: SV: [xsl] xsl doesnt produce valid xhtml
Date: Tue, 21 Oct 2003 08:51:52 +0200

First of all, you can't attach files to this list (as you where informed
when you signed up).
Second, my guess is, that yuor processor complains simply because it isnt
valid XHTML you are making.

Perhaps your XHTML declaration is set to strict, and in that case a valid
XHTL table look like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
	<head>
		<title>Enter the title of your XHTML document here</title>
	</head>
	<body>
		<p>Enter the body text of your XHTML document here</p>
		<table>
			<tbody>
				<tr>
					<th>Header</th>
				</tr>
				<tr>
					<td>Cell</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>

> are there any ways to get
> around producing
> valid xhtml ?

Yup, just format your output as your whish, and instruct the parser to make
plain XML, and then omit the xml declaration, and put your own html tags in
the output, something like this

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
omit-xml-declaration="yes"/>
	<html>
		<head>
			<title>Enter the title of your HTML document
here</title>
		</head>
		<body>Enter the body text of your HTML document her</body>
	</html>
</xsl:stylesheet>

<thomas/>



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread