Re: The XSL-List Digest V3 #86

Subject: Re: The XSL-List Digest V3 #86
From: "Sebastian Rahtz" <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Jun 2000 21:55:46 +0100 (BST)
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


Current Thread