|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: The XSL-List Digest V3 #86
Perry Roland writes:
> I'm attempting to transform one XML file into another. The only
> modification I want to make is to add IDs to div elements. That part
> works correctly; however, I'm having trouble processing comments. I'm
> probably missing something very elementary and that's probably why I'm
> having such a hard time seeing what's wrong. I'm using saxon.
>
> As you can see, I'm not getting comments in the output.
um. When I run your file, I *do* get comments. what XML parser
are you using with Saxon? is it possibly one which does not pass on
comments to the XSL processor?
> If this proves too easy, I have another question, too. Elements without
> content, given in the XML source file as "<head></head>", show up in the
> output as self-terminating, e.g. "<head/>". Is there a way to force
> saxon to output both start and end tags?
I believe not, without writing a new output handler. Why do you want
to, exactly?
actually, one way to force it is this:
<xsl:template match="head">
<head>
<xsl:if test=". =''"><xsl:comment>no head content</xsl:comment></xsl:if>
<xsl:apply-templates/>
</head>
</xsl:template>
which may be useful?
sebastian
PS I don't think the generate-id() ID looks very nice; I think I'd use
xsl:number and the element name to generate something like "div2-34"
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








