[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Non-well-formed HTML in XSL

Subject: RE: Non-well-formed HTML in XSL
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 16 Jul 2002 22:07:57 +0100
print html from xslt
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.