RE: [xsl] Simple Letter - Trying to drop children after element

Subject: RE: [xsl] Simple Letter - Trying to drop children after element
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 18 Aug 2005 15:00:52 +0100
If you remove the xsl:import, and the call to logoAddress, then the
stylesheet doesn't output any bullet elements. So it must be something in
the part you haven't shown us.

The bullets aren't being output by the para template, therefore there is
nothing the para template can do to stop them being output. You either have
to avoid invoking the bullet template, or you have to make the bullet
template refrain from producing output.

Your XML source document has spurious indentation suggesting that the
bullets might be children of a para, but they aren't. This might be
confusing you.

Michael Kay
http://www.saxonica.com/ 



> -----Original Message-----
> From: Arthur Maloney [mailto:ArthurM@xxxxxxxxxx] 
> Sent: 18 August 2005 13:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Simple Letter - Trying to drop children after element
> 
> Hello xsl-list,
> 
> I can't figure out how to drop the child bullets after
> a para. Other than that code works fine
> 
> I'm using
> <xsl:template match="para">
> <p><xsl:value-of select="."/>
> ? how to drop child bullets here ?
> e.g. using <xsl:apply-templates select="//bullet"/>
> drops all bullets for all paras after each para.
> </p>
> </xsl:template>
> 
> <xsl:template match="bullet">
> <ul>
>    <li><xsl:value-of select="."/></li>
> </ul>
> </xsl:template>
> 
>        --oooOooo--
> 
>   xml fragment
> 
>   <stdLetter>
>      <para>paragraph one</para>
>      <para>paragraph two</para>
>         <bullet>p2 bullet one</bullet>
>         <bullet>p2 bullet two</bullet>
>      <para>paragraph three</para>
>          <bullet>p3 bullet 1</bullet>
>      <para>paragraph four</para>
>      ...
>   </stdLetter>
> 
> 
> 
>        --oooOooo--
>        
> Stylesheet in full as is, some bits in the artifacts library
> 
> <?xml version="1.0"?>
> <xsl:stylesheet 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
>    <!-- stdInstruction.xsl created 2005-07-26T14:41 -->
>    <!--  Top level declarations -->
>    <xsl:import href="libArtifacts.xsl"/>
>    <xsl:output method="xml" indent="yes"/>
>    
>    <xsl:param  name="plainNameOne" select="''"/> 
>    <xsl:param  name="formalNameOne" select="''"/>    
>    <xsl:param  name="formalLastNameOne" select="''"/> 
>    <xsl:param  name="addressLabelOne" select="''"/>       
>    <xsl:param  name="plainNameTwo" select="''"/> 
>    <xsl:param  name="formalNameTwo" select="''"/>    
>    <xsl:param  name="formalLastNameTwo" select="''"/> 
>    <xsl:param  name="addressLabelTwo" select="''"/>       
>    <xsl:param  name="date" select ="'not dated'"/>
>    <xsl:param  name="title" select ="''"/>   
> 
>    <xsl:template match="/">
>       <xsl:element name="html">
>          <xsl:element name="head">
>             <title><xsl:value-of select="$title"/></title>
>          </xsl:element>
>          <xsl:element name="style">
>          <xsl:text>@import url(../css/stdLetter.css);</xsl:text>
>                 </xsl:element>
>          <body>
>          <xsl:call-template name="logoAddress"/>
>          <xsl:call-template name="addressee"/>
>             <xsl:apply-templates select="/stdLetter/title"/>         
>             <xsl:apply-templates select="/stdLetter/para"/>
>             <xsl:apply-templates select="/stdLetter/signature"/>
>          </body>
>       </xsl:element>
>    </xsl:template>
>    
>    <xsl:template name="addressee">
>       <p><xsl:value-of select="$formalNameOne"/></p>
>       <p><xsl:value-of select="$addressLabelOne"/></p>
>         <p><xsl:value-of select="$date"/></p>
>         <p><xsl:text>Dear </xsl:text><xsl:value-of 
> select="$formalLastNameOne"/></p>
>    </xsl:template>
>    
>   
>    <xsl:template match="title">
>         <h3><xsl:value-of select="."/></h3>
>    </xsl:template>   
>    
>    <xsl:template match="para">
>         <p><xsl:value-of select="."/></p>
>    </xsl:template>   
>  
>    <xsl:template match="signature">
>       <p><xsl:value-of select="."/></p>
>    </xsl:template>
>    
>    <xsl:template match="bullet">
>       <ul>
>          <li><xsl:value-of select="."/></li>
>       </ul>
>     </xsl:template>
> </xsl:stylesheet>
> 
> 
> -- 
> Best regards,
>  Arthur                          mailto:ArthurM@xxxxxxxxxx

Current Thread