Subject: Re: [xsl] Multiple elements condition From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 27 Aug 2007 11:07:26 -0400 |
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:for-each select="para"> <fo:block start-indent="30pt" end-indent="30pt"> <xsl:text>□ </xsl:text> <xsl:apply-templates/> </fo:block> </xsl:for-each>
</xsl:when> <xsl:otherwise> <xsl:apply-templates/>
<fo:block start-indent="30pt" end-indent="30pt"> <xsl:apply-templates/> </fo:block>
-- Upcoming public training: XSLT/XSL-FO Sep 10, UBL/code lists Oct 1 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Multiple elements condition, Maxine Pensyl-Johnso | Thread | RE: [xsl] Multiple elements conditi, Maxine Pensyl-Johnso |
RE: [xsl] Select Nodes, cknell | Date | Re: [xsl] Select Nodes, Paulus Jacko |
Month |