Subject: RE: [xsl] Non-well-formed HTML in XSL From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Tue, 16 Jul 2002 22:07:57 +0100 |
> I would like to print HTML that will (eventually) be > well-formed. However, the XSL to display it is not > well-formed and thus I get an error. What I need is a way to > tell XSL to disregard the non-well-formedness of the HTML I'm writing. > > <xsl:if test="ancestor::node()[position() != 1]"> > </tr><tr> # this is the problem > </xsl:if> > No, what you need is a better understanding of the XSLT processing model. The stylesheet, like the source and result documents, are trees. <xsl:if> is a node on this tree; if the condition is true, then the subtree under the <xsl:if> node is evaluated, if not, it is ignored. Similarly <tr></tr> represents an element node, and in a stylesheet, this acts as an instruction to construct a <tr/> element on the result tree. Now if </tr><tr> means anything, it is half of one node and half of another, so you're asking xsl:if to evaluate half of one instruction and half of another. This obviously doesn't make sense. You've got to change your way of thinking. Instead of thinking abuot writing start tags and end tags, you've got to structure the stylesheet around the nodes you want to write. In your case there is a very simple mapping from source nodes to result nodes, so this isn't at all difficult. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Non-well-formed HTML in X, Thomas B. Passin | Thread | RE: [xsl] Non-well-formed HTML in X, Richard Mitchell |
Re: [xsl] Non-well-formed HTML in X, Thomas B. Passin | Date | RE: [xsl] node responding to ancest, Michael Kay |
Month |