[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Total Missing documents for each Event‏

Subject: Re: Total Missing documents for each Event‏
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 09 Apr 2010 01:33:49 +0100
Re:  Total Missing documents for each Event‏
On 08/04/2010 19:27, Shashank Jain wrote:

Hello All,


I am trying to create the list of missing documents and their count for each event.

<data>
<event_template sp_mand_doctypes="PSC Minutes, Internal Approval, Rationale, Trade Instructions, IPS, Final Client Models">
<event>
     <document_type sp_document_type="Final Client Models"/>
</event>
<event>
     <document_type sp_document_type="Final Client Models"/>
     <document_type sp_document_type="Rationale"/>
</event>
<event>
     <document_type sp_document_type="Analyst"/>
</event>
<event_template>
</data>

So my table should look like

For 1st Event list of missing documents will be [PSC Minutes, Internal Approval, Rationale, Trade Instructions, IPS] and count is 5
For 2nd Event list of missing documents will be [PSC Minutes, Internal Approval, Trade Instructions, IPS] and count is 4
For 3rd Event list of missing documents will be [PSC Minutes, Internal Approval, Rationale, Trade Instructions, IPS, Final Client Models] and count is 6. "Analyst" is not the mandatory document as it is not present in the sp_mand_doctype list.

I am using this following code.

<xsl:for-each select="event">
     <xsl:call-template name =" DocsMissing "/>
</xsl:for-each>

<xsl:template name="DocsMissing">
         <xsl:choose>
                 <xsl:variable name="mandatoryDocs" select="parent::node()/@sp_mand_doctypes"/>
....
          </xsl:if>
>      </xsl:template>
>
> With this I am able to right number of Missing Docs f

It's a syntax error to have an xsl:variable at this point, so i wouldn't have expected this to run at all?
I think you just want


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:template match="event_template">
<xsl:variable name="x"
select="tokenize(@sp_mand_doctypes,'\s*,\s*')"/>
<xsl:for-each select="event">
For event <xsl:value-of select="position()"/>
<xsl:text> list is </xsl:text>
<xsl:value-of select="$x[not(.=current()/document_type/@sp_document_type)]"
separator=","/>
<xsl:text> count </xsl:text>
<xsl:value-of select="count($x[not(.=current()/document_type/@sp_document_type)])"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.