Re: [xep-support] xsl:for-each within xsl:variable

From: Geoff Levner <geoff@n-generate.com>
Date: Wed Jul 20 2005 - 08:07:27 PDT

Actually it is neither FOP nor XEP that transforms your document, but
whatever XSLT processor is being used. I believe XEP uses Saxon by
default, but you can set it up to use Xalan or whatever processor you
want. I don't know about FOP.

That said, I don't know why your code doesn't work, but a simpler
solution might be to have two different templates: one for the first
keyword, which would prefix the keyword by "Keyword(s):", and one for
the others, which would prefix the keyword with a comma. Something
like this:

<xsl:template match="keyword[1]">
        <xsl:call-template name="display1">
                <xsl:with-param name="label" select="'Keyword(s):'" />
                <xsl:with-param name="content" select="..." />
        </xsl:call-template>
</xsl:template>

<xsl:template match="keyword">
        <xsl:call-template name="display1">
                <xsl:with-param name="label" select="','" />
                <xsl:with-param name="content" select="..." />
        </xsl:call-template>
</xsl:template>

I'm just typing off the top of my head, so I could be wrong about the
exact syntax...

Geoff

On 20 Jul 2005, at 16:28, Matthew Richardson wrote:

> I'm having an odd display problem with a stylesheet of mine and
> wondered if anyone on the list could point out what I'm doing wrong. I
> have a repeateable element that I transform into a comma-delimited
> list. My first callout looks like this:
>
> <xsl:apply-templates select="keyword[1]" />
>
> And that template looks like this:
>
> <xsl:template match="keyword">
> <xsl:variable name="content2">
> <xsl:for-each select="../keyword">
> <xsl:value-of select="." /><xsl:if test="position()!=last()">,
> </xsl:if>
> </xsl:for-each>
> </xsl:variable>
> <xsl:call-template name="display1">
> <xsl:with-param name="label" select="'Keyword(s):'" />
> <xsl:with-param name="content" select="$content2" />
> </xsl:call-template>
> </xsl:template>
>
> The $content2 variable gets set to the first instance of keyword only.
> It doesn't seem to be executing the xsl:for-each. This is confusing
> because this same code worked just fine under FOP (i.e, that's why I'm
> asking this list). I structured it this way because I want the lable
> "Subject Term(s):" to appear once, not once for each keyword.
>
> The display1 template just turns it into a two-column table row;
> that's working fine. Is there something I'm missing here? Any
> suggestions?
>
> Matthew A. Richardson
> Inter-university Consortium for Political and Social Research
> Phone: 734.615.7901
> Email: matvey@umich.edu
> "Everything tires with time, and starts to seek some opposition,
> to save it from itself." --Clive Barker, The Hellbound Heart
> -------------------
> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
> in the body of the message to majordomo@renderx.com from the address
> you are subscribed from.
> (*) By using the Service, you expressly agree to these Terms of
> Service http://www.renderx.com/terms-of-service.html
>

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html
Received on Wed Jul 20 08:35:01 2005

This archive was generated by hypermail 2.1.8 : Wed Jul 20 2005 - 08:35:02 PDT