Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 12th, 2007, 01:06 PM
Registered User
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with Preceding

Hi,

Problem : I have an xml document and create another with it from the contents. I looping trought "Forms" and then the xml thats created is sent to the printer to print. Problem is some forms show more than once in the xml and I only want to output it in the new xml once.

Here is what I'm trying with, up to now.

*** Example of a Form Node ***
<NO-FORMULAIRE value="CD-999" styleSheet="CD-999_F_20020401.xsl">
    <SENTINELLE-IMPRESSION-AC>X</SENTINELLE-IMPRESSION-AC>
</NO-FORMULAIRE>

<LOOP on forms>
<xsl:if test="not(preceding::CLAU-INFO/NO-FORMULAIRE[@value=$currentValue][CLAU-INFO/SENTINELLE-IMPRESSION-AC='X'])"
    <xsl:call-template name="STATFORM"/>
</xsl:if>
</LOOP>

$currentvalue is the current form that the loop is in
SENTINELLE-IMPRESSION-AC is = to X when it needs to be printed.

I hope I explained everything clearly.

Thanks in advance for the help
Frank

 
Old November 12th, 2007, 06:20 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There's not enough information here to see where you are going wrong.

The use of not(X = preceding::X) is typically a very inefficient way of removing duplicates, though it can be viable on small documents. In XSLT 2.0 use for-each-group; in 1.0 use Muenchian grouping with keys (see www.jenitennison.com/xslt/grouping)

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using preceding-sibling mcanne98 Infopath 0 September 11th, 2008 11:09 PM
Preceding-sibling question. lafilip XSLT 7 March 5th, 2007 12:35 PM
preceding-sibling descendant xaun XSLT 3 February 28th, 2006 02:48 PM
preceding-sibling jonesyp XSLT 2 November 22nd, 2005 12:29 PM
preceding and empty tag sven.ansem@sogeti.nl XSLT 1 July 8th, 2003 10:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.