This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


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

Re: Solution to funky TOCs in HTML Help...


At 22:51 13/08/01 +0200, Jirka Kosek wrote:
>"Dave Brooks, BCS Systems" wrote:
> >
> > At 21:36 13/08/01 +0200, Jirka Kosek wrote:
> >
> > >They are usefull, but in XSLT there is no easy way to strip leading and
> > >trailing new-line from
> > >
> > ><xxx>
> > >foo
> > >bar
> > ></xxx>
> >
> > <xsl:template match="xxx">
> >    <xsl:value-of select="normalize-space(text())"/>
> > </xsl:template>
> >
> > should do this,
>
>It looks like I simplified example too much.;) In fact I have in mind
>the case where xxx elment has also some subelements (very common case).
>In that case, there is no single instruction or function to strip
>leading and trailing line endings.

The following should do the job:

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   version="1.0"> 
_
                                                                               _
   <xsl:output 
_
     method="text" 
_
     version="1.0" 
_
     standalone="yes" 
_
     omit-xml-declaration="yes" 
_
     indent="no" 
_
   /> 
_
                                                                               _
   <xsl:strip-space 
elements="*"/>                                             _
                                                                               _
   <xsl:template 
match="*">                                                    _
     <xsl:for-each select="text() | ./*"><xsl:value-of 
select="concat(normalize-space(), ' ')"/></xsl:for-each>
   </xsl:template> 
_
                                                                               _
</xsl:stylesheet>                                                             _



Best regards,


Dave


----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>


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