AW: Re: [xsl] Problem with a for-each in xsl:variable

Subject: AW: Re: [xsl] Problem with a for-each in xsl:variable
From: "Huditsch Roman" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Wed, 20 Oct 2004 08:32:57 +0200
Hi Jeni,

Wow, you are really great!!
It works absolutely fine!
Thank you very very much for your help!!!

Cheers,
Roman

-----Urspr|ngliche Nachricht-----
Von: Jeni Tennison [mailto:jeni@xxxxxxxxxxxxxxxx]
Gesendet: Dienstag, 19. Oktober 2004 18:07
An: Huditsch Roman
Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: [Maybe Spam] Re: [xsl] Problem with a for-each in xsl:variable

Hi Roman,

> Yes, that's true. But I don't want the jur_block elements to get
> numbered. They should stay as they are.
>
> I just want to add new <nummer> elements (with the splitted number
> values for the jur_block within range) under <stichwort>.

Sure. But the numbers that you want to add under <stichwort> need to
come from the <jur_block> elements, right? The way I was suggesting
you achieve this is to apply templates to the <jur_block> elements in
order to create the <nummer> elements. If you apply templates to those
<jur_block> elements within a <stichwort> element that you've created,
then the <nummer> elements you create will appear within that
<stichwort> element. Use a mode if you need to apply templates to the
<jur_block> elements in other places in your stylesheet as well. For
example, try:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:ln="http://myNamespace/schema/norm";
                exclude-result-prefixes="ln">

<xsl:template match="node()|@*">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
  </xsl:copy>
</xsl:template>

<xsl:key name="blocks" match="ln:jur_block" use="ln:zaehlung" />

<xsl:template match="stichwort">
  <stichwort>
    <xsl:apply-templates select="term" />
    <xsl:apply-templates select="key('blocks',
                                     substring-before(nummer, '-'))"
                         mode="nummer">
      <xsl:with-param name="end"
                      select="substring-after(nummer, '-')" />
    </xsl:apply-templates>
  </stichwort>
</xsl:template>

<xsl:template match="ln:jur_block" mode="nummer">
  <xsl:param name="end" />
  <nummer><xsl:value-of select="ln:zaehlung" /></nummer>
  <xsl:if test="$end != ln:zaehlung">
    <xsl:apply-templates select="following-sibling::ln:jur_block[1]"
                         mode="nummer">
      <xsl:with-param name="end" select="$end" />
    </xsl:apply-templates>
  </xsl:if>
</xsl:template>

</xsl:stylesheet>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

Current Thread