RE: RE: [xsl] Multiple elements condition

Subject: RE: RE: [xsl] Multiple elements condition
From: cknell@xxxxxxxxxx
Date: Mon, 27 Aug 2007 11:42:47 -0400
Pardon me for replying to myself, but reading Ken's message alerted me to the fault in my template. Let me correct it.

<xsl:template match="note[count(para) > 1]">
  <fo:block keep-together="always">
  	<xsl:for-each select="para">
      <fo:block text-align="center" font="bold 11pt arial" space-before="3mm"> NOTE</fo:block>
        <fo:character character=" "/><xsl:value-of select="para"/>
      </fo:block>
    </xsl:for-each>
  </fo:block>
</xsl:template>

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     cknell@xxxxxxxxxx
Sent:     Mon, 27 Aug 2007 11:12:58 -0400
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  RE: [xsl] Multiple elements condition

<xsl:template match="note[count(para) > 1]">
  <fo:block keep-together="always">
    <fo:block text-align="center" font="bold 11pt arial" space-before="3mm"> NOTE</fo:block>
      <fo:character character=" "/><xsl:value-of select="para"/>
    </fo:block>
  </fo:block>
</xsl:template>

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Maxine Pensyl-Johnson <Maxine.Pensyl-Johnson@xxxxxxx>
Sent:     Mon, 27 Aug 2007 07:55:51 -0700
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  [xsl] Multiple elements condition


Greetings everyone,

I've been trying to wrap my head around this problem and so far have
only succeeded in creating a headache. I keep thinking I'm making it
more difficult than it needs to be. Your help is very much appreciated.
Thank you in advance.

Max


Saxon 6.5.5
XPATH 1.0

Problem: When there are two or more <para> tags inside of a <note> tag
output the <para> tags as a bulleted list. (Why didn't the author use a
bulleted list to begin with? I don't know).

Example:
                    <note>
                        <para>Misc text.</para>
                        <para>Misc text.</para>
                        <para>Misc text.</para>
                        <para>Misc text.</para>
                    </note>

Should transform to:

*Misc text.
*Misc text.
*Misc text.
*Misc text.

XSL Code:

	<xsl:template match="note">
		<fo:block keep-together="always">
			<fo:block text-align="center"  font="bold 11pt
arial" space-before="3mm" >NOTE</fo:block>
			<fo:block padding-left="30pt"
padding-right="30pt">
				<xsl:choose>
					<xsl:when test="count(note/para)
> 1">
						<fo:character
character=" "/> <xsl:value-of select="para"/>
</xsl:when>
					<xsl:otherwise>
						<xsl:apply-templates/>
					</xsl:otherwise>
				</xsl:choose>
			</fo:block>
		</fo:block>
	</xsl:template>

Current Thread