Subject: RE: closing a template inside a table, forbidden?
From: "Hubert Holtz" <Turnhose_alt@xxxxxxx>
Date: Sat, 04 Jan 2003 16:49:32 +0100
|
Hy Julian,
it should output this certain table every time an article element exists, with the title of the article
at the top of the table, and then depending on the existence of a sect1 element, adding the elemnts in it and so on.
At the moment it looks like this,without the article/title as a headline in my document. :
---CODE---
<xsl:template match="article">
<table border="0" cellspacing="0" cellpadding="0" width="610" height="48">
<tr>
<td rowspan="2" height="48" width="162"><xsl:apply-templates select="mediaobject[@id='titel']"/></td>
<td height="28" width="100%" id="mainColor"></td>
</tr>
<tr>
<td height="20" width="100%" id="hiColor"><xsl:apply-templates select="mediaobject[@id='box']"/></td>
<td></td>
</tr>
</table>
<table width="610" height="48" cellpadding="0" cellspacing="0" border="0" id="sectBackground">
<tr>
<td colspan="3" height="20" width="610" id="white" align="right"><xsl:apply-templates select="link"/></td>
</tr>
<xsl:choose>
<xsl:when test ="mediaobject[@id='contentpicture']"> <!-- sollte es kein Bild geben wird der Abstand zum Kategorietitel verringert -->
<tr>
<td colspan="3" height="10"><img src="fake.kill/img/pixel.gif" height="10" width="610" /></td>
</tr>
<xsl:apply-templates select="mediaobject[@id='contentpicture']"/>
</xsl:when>
<xsl:otherwise>
<tr>
<td colspan="3" height="25"><img src="fake.kill/img/pixel.gif" height="10" width="610" /></td>
</tr>
</xsl:otherwise>
</xsl:choose>
</table>
<xsl:apply-templates select="sect1[@lang = $lang or not(@lang)]"/>
</xsl:template>
<!-- ************SECT1 PROCESSING CONTENT ************** -->
<xsl:template match="article/sect1[@lang= $lang or not(@lang)]">
<table width="610" height="48" cellpadding="0" cellspacing="0" border="0" id="sectBackground">
<!-- MARKED POSITION FOR ARTICLE TITLE -->
<xsl:apply-templates/>
</table>
<xsl:apply-templates select="../note[@lang= $lang]"/>
</xsl:template>
<!-- ************SECT1 PROCESSING CONTENT END*********** -->
...
---CODE--
I want to add the article title at the marked position. But if I do it that way, I have the title in every sect1 element of course.
So I thought I could make the template for matching an article a little bit longer, that it includes the start of the table, and then just put the title at its position.
But now I see that this cannot work and I don't want to create a whole new table for a single title.
So how would you do it?
Thanks.
Homer30
*********** REPLY SEPARATOR ***********
On 04.01.2003 at 15:11 Julian Reschke wrote:
>Yes.
>
>XSLT documents must be well-formed XML.
>
>What is it supposed to do?
>
>--
><green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760
>
>> -----Original Message-----
>> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Hubert Holtz
>> Sent: Saturday, January 04, 2003 2:53 PM
>> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
>> Subject: closing a template inside a table, forbidden?
>>
>>
>> Hy,
>>
>> is this forbidden ?
>>
>> -----CODE-----
>>
>> <xsl:template match="article">
>> <table>
>> ...
>>
>> </table>
>> <!-- ************SECT1 PROCESSING CONTENT ************** -->
>>
>> <table width="610" height="48" cellpadding="0"
>> cellspacing="0" border="0" id="sectBackground">
>>
>> <xsl:apply-templates select="./title[@lang= $lang]"/>
>> <xsl:apply-templates select="sect1[@lang = $lang or
>> not(@lang)]"/>
>>
>> </xsl:template>
>>
>> <xsl:template match="article/sect1[@lang= $lang or
>> not(@lang)]">
>>
>>
>> <xsl:apply-templates/>
>>
>> </table>
>>
>> ----CODE----
>>
>> I get the following error:
>>
>> The element type "table" must be terminated by the matching end-tag "".
>>
>> description org.apache.cocoon.ProcessingException: Exception in
>> creating Transform Handler: org.xml.sax.SAXParseException: The
>> element type "table" must be terminated by the matching end-tag "".
>>
>> And if it is forbidden, why?
>>
>> Thanks.
>> Steve
>>
>>
>> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
J
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|