This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: : RE: suppressing default template rules


> <?xml version="1.0" ?>
> <custdet>custdettag
>     <employee>emptag</employee>
>     <firstname>first</firstname>
>     <lastname>last</lastname>
> </custdet>

> The expected output (as per the following node
> structure)_
>
> / (root node)
>  +- custdet
>  |   +- 'custdettag'
>     +- employee
>     |   +- 'emptag'
>     +- firstname
>     |   +- 'first'
>     +- lastname
>         +- 'last'

This is correct when using <xsl:strip-space elements="*"/>. And from the
name 'strip-space' you can already see where it comes from: from the
whitespaces. They are between the end of one node and the beginning of the
next node. The complete tree of custdet:

+-- custdet
|  +--  'custdettag        '   (including one linebreak)
   +--  employee
   +--  '             '     (whitespaces + linebreak)
   +--  firstname
   +--  '             '
   +--  lastname

If you write the whle XML in 1 line without whitespaces, you will see the
expected output too. You also can change the <xsl:apply-templates/> in the
template matching on * change to <xsl:apply-templates
select="*|text()[normalize-space()]"/>. Or change the template matching on
text() to <xsl:template match="text()[normalize-space()]"/>.

Regards,

Joerg


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]