|
Subject: [xsl] Numbering and adding commas From: Terry Ofner <tofner@xxxxxxxxxxx> Date: Fri, 10 Mar 2006 18:05:07 -0500 |
Greetings,
I have been hitting my head against this problem for several days. I was
determined to figure it out on my own with the various resources now
available. But no love.
I have questions with multiple answer tagged, such as this one:
<topic>Finding Nouns</topic>
<item> 1. At one <answer>time</answer> <answer>dinosaurs</answer> were
<answer>rulers</answer> of the <answer>earth</answer>.</item>
Some items have only one answer tagged:
<item> 2. <answer>Most</answer> of the flags before then were actually
poles</item>
I am trying to list the answers for each item after the number. But then I
am also trying to add a comma after all but the last item in the list, like
this:
1. time, dinosaurs, rulers, earth
Here is relevant part of my stylesheet:
<xsl:template match="item">
<xsl:text> </xsl:text>
<xsl:text>	</xsl:text>
<xsl:number count="item" level="any" from="topic" format="1.	"/>
<xsl:for-each select="answer | ansus | ansdus | embedded |
attribute::answer">
<xsl:if test="position() != last()">
<xsl:apply-templates select="."/>, <xsl:text/>
</xsl:if>
</xsl:for-each>
</xsl:template>
This current snippet produces the output below, in which the last answer has
been cut completely.
Finding Nouns
1. time, dinosaurs, rulers,
I love reading the list. Please excuse my newbie malformed code.
Terry
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Obscuring static content , G. Ken Holman | Thread | RE: [xsl] Numbering and adding comm, Michael Kay |
| Re: [xsl] Transform xml to html, Andrew Franz | Date | Re: [xsl] Re: XSL:FO for .NET, Karl Stubsjoen |
| Month |