[xslt] xsl:choose With Preserved Space



Hi there,

either I have missed the answer, or you guys missed my post :-) I'll try 
again.

Consider the following template:

   <xsl:template match="/">
     <elem xml:space="preserve">
     <xsl:choose>
       <xsl:when test="1=1">
         <true/>
       </xsl:when>
     </xsl:choose>
     </elem>
   </xsl:template>

The output method is XML. Now run xsltproc on it using any XML document 
and you'll see it report an error, stating that it expects xsl:when to 
be the first thing in xsl:choose.

The xml:space attribute causes the whitespace not to be stripped. Then, 
at some point, xsltChoose function takes over and checks if a xsl:when 
element is the first child of xsl:choose. It is not, of course, the 
first child is a text node which contains whitespace. As an answer to 
that, xsltChoose function aborts with an error.

As I see it, xsltChoose should output this whitespace into the resulting 
document. Xalan and MSXML share my opinion and do just that.

Now, is this an error in libxslt, or are Xalan, MSXML and I wrong here?

Ciao,
Igor




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]