Tim Hibbs schrieb am 18.02.2010 um 12:16:59 (-0600): > 1. In the XSL below, is it a reasonable approach to discard > "unwanted" text nodes with the template > > <xsl:template match="frq:From | frq:HeaderDate | frq:HeaderTime > | frq:FaxNumber"> > </xsl:template>?
I'd prefer <xsl:template match="..."/>, the other version might result in additional whitespace depending on your settings. > * Is there a better way to do this? > * Must this be done element-by-element, or is there a > "shorthand" way of eliminating a set of sibling nodes via XPath > expression? <!-- discard all element nodes below frq:CommonData --> <xsl:template match="frq:CommonData/*"/> Read up about priorities when matching nodes. > 2. Given the inclusion of the namespace specifier > "xmlns:frq="http://www.fedex.com/schemas/freightRateQuotation" in the > XSL, must all references to nodes in that namespace always be preceded > with "frq:" wherever they are referenced (such as in xsl:template > match="..." statements)? Yes. > 3. I'd like to "left align" the "To:" and "Email Address:" lines in > my output. Is there a defined set of output formatting rules in XSL > (which in particular defines how output lines are indented)? Whitespace accuracy is a bit tedious in all template languages I've seen, which has to do with the nature of the template: sometimes you want the whitespace for output, sometimes you want it only for source code formatting. Take a look at <xsl:strip-space> and <xsl:text>. Newline with numeric character reference: <xsl:text> </xsl:text> > As suggested yesterday by Michael Ludwig, I included an "<xsl:output > method="html" indent="yes"/>" line, but that doesn't seem to impact > other than the HTML syntax elements. If you want plain text: <xsl:output method="text"/> General XSL questions are better asked at xsl-list at mulberrytech dot com. -- Michael Ludwig