RE:RE: [xsl] closing a template inside a table, forbidden?

Subject: RE:RE: [xsl] closing a template inside a table, forbidden?
From: "Hubert Holtz" <Turnhose_alt@xxxxxxx>
Date: Sat, 04 Jan 2003 17:03:26 +0100
Sorry for this question, found my thinking-error, it seems that I'm sometimes a little bit dumb. :-)

Now this works fine:

-- CODE ---
<xsl:template match="article">
...
<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)]"/>
           </table>
           
           <xsl:apply-templates select="../note[@lang= $lang]"/>
           
  </xsl:template>
		
	<!-- ************SECT1 PROCESSING CONTENT ************** -->
		
	<xsl:template match="article/sect1[@lang= $lang or not(@lang)]"> 
		 
		 		  <xsl:apply-templates/>
			
	</xsl:template>
...

---CODE---

I hope you will forgive :-)

Homer30

*********** REPLY SEPARATOR  ***********

On 04.01.2003 at 10:13 cknell@xxxxxxxxxx wrote:

>Yes, it is illegal because you are attempting to do exactly what the
>error message is complaining about. You are trying to output ill-formed
>XML. the problem is not closing a template inside a table, but lies in
>closing a template inside a table which has been opened outside the table,
>here is a short illustration:
>
><xsl:template>
>  <table>
></xsl:template>
>  </table>
>
>As you see, the closing tag </xsl:template> does not match the opening tag
><table>, and that's what the Saxon parser is complaining about. You will
>have to re-think your design so that the opening and closing tags match.
>In other words, you must output well-formed XML.
>
>This topic has been recently been discussed at length in the thread
>concering the advisability of using disable-output-escaping (d-o-e) which
>you probably have seen. The anti-d-o-e faction (I must count myself among
>them) generally attributes this kind of error to a programmer's clinging
>to procedural programming pratices (trying to emit XML tags instead of
>nodes) rather than embracing the functional or declarative model upon
>which XSLT is based. Consider SQL vs. Java. In the former you tell the
>database what you want and let the database engine figure out exactly how
>to get it. With the latter, you concern yourself with loops and branching
>and output, and etc.
>
>XSLT is more along the lines of SQL, than those of Java. I think this is
>one of those ideas where one day, a lightbulb suddenly goes on in your
>head and you say, "Ohhh, now I get it!" It can be rough sledding until
>that happens.
>-- 
>Charles Knell
>cknell@xxxxxxxxxx - email
>
>
>
>-----Original Message-----
>From:     "Hubert Holtz" <Turnhose_alt@xxxxxxx>
>Sent:     Sat, 04 Jan 2003 14:53:26 +0100
>To:       XSL-List@xxxxxxxxxxxxxxxxxxxxxx
>Subject:  [xsl] 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




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


Current Thread