[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Whitespace between nodes
> As a further illustration: as it happens your XSL code is the same as > > <q> > <xsl:choose> > <xsl:when test="@href != ''"> > <a href="{@href}">...</a> > </xsl:when> > ... > </xsl:choose> > </q> > > Would you agree that, in this case, it should be: > <q> > <a href="...">...</a> > </q> > ? > Assuming that the output method is HTML, the output should be <q><a href="...">...</a></q> whether or not indent="yes" has been set. This is because of the rule (from XSLT 1.0 section 16.2) that: "If the indent attribute has the value yes, then the html output method may add or remove whitespace as it outputs the result tree, so long as it does not change how an HTML user agent would render the output. The default value is yes." The XSLT 2.0 Serialization spec retains this rule and gives implementations additional guidance on its implications. See section 6.3 of http://www.w3.org/TR/xslt-xquery-serialization/ "Whitespace must not be added or removed adjacent to an inline element. The inline elements are those included in the %inline category of any of the HTML 4.01 DTD's, as well as the INS and DEL elements if they are used as inline elements (i.e., if they do not contain element children)." The <a> element is an inline element, so the whitespace above should not have been added. However, as far as I can see the responses to the original question have been very confused. I don't think it has been clearly established whether the unwanted whitespace came (a) from whitespace-only text nodes in the source (in which case it should be removed using xsl:strip-space), (b) from significant whitespace in the source (in which case it should be removed using normalize-space()), or (c) as a result of output indentation. The remedies in the three cases are quite different. Michael Kay Michael Kay
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|