Subject: duplicate problem
Posted By: dextermagnific Post Date: 8/7/2006 5:31:23 AM
Hi,

i have the following source :

<block>
 <property name="BlockType" value="Reference />
 ....
 <property name="SourceBlock" value="fonctions/SubSystem1" />
</block>

<block>
 <property name="BlockType" value="Reference />
 ....
 <property name="SourceBlock" value="fonctions/SubSystem2" />
</block>


The interesting thing here is the 'fonctions' word.
i'd like to produce something like : 'use fonctions;'

but with the following code

<xsl:for-each select="block[property[@name='BlockType' and @value='Reference']]">
      <xsl:text>use </xsl:text>
      <xsl:value-of select="substring-before(property[@name='SourceBlock']/@value,'/')" />
    </xsl:for-each>

i have the 'use fonctions;' twice. i'd like to have it once per SourceBlock value (before the '/').

Any ideas ? i tried with grouping but i don't have enough experience.

Thanks

Reply By: mhkay Reply Date: 8/7/2006 11:55:16 AM
You're right that this is a grouping problem. First thing is to establish whether you're using 1.0 or 2.0.

Try to tackle some simpler grouping problems first, and build up to this one. For example, see if you can do it in the case where "fonctions" is a separate attribute on its own.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 48088

Return to index page 210
Return to index page 209
Return to index page 208
Return to index page 207
Return to index page 206
Return to index page 205
Return to index page 204
Return to index page 203
Return to index page 202
Return to index page 201