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

RE: Two different input get single output

Subject: RE: Two different input get single output
From: "Selvaganesh" <selvaganesh_t@xxxxxxxxxxxxxx>
Date: Tue, 8 Dec 2009 19:05:29 +0530
RE:  Two different input get single output
Hi Martin,

Thanks your effort for the xsl, when I process the xsl, the "saxon9" process
show some error. But the output xml was generated.

Error:
=====

Recoverable error

XTRE0540: Ambiguous rule match for /cases/section[2]/type[1]
Matches both "section/type[.='Drafting']" on the 32 of file: name.xsl
and "section/type[not<normalize-string>]" on line 28 of file name.xsl

Repeating the above error for all section.

Please guide me how to correct.

Thanks,
Selva

-----Original Message-----
From: Martin Honnen [mailto:Martin.Honnen@xxxxxx] 
Sent: Monday, December 07, 2009 6:13 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Two different input get single output

Selvaganesh wrote:

> I have challenging for xsl creating of two different input xml and get
> single output xml file. Can you guide us how is prepare in easy way.

This XSLT 2.0 stylesheet:

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   exclude-result-prefixes="xsd"
   version="2.0">

   <xsl:param name="url2" as="xsd:string" select="'test2009120703.xml'"/>
   <xsl:variable name="doc2" select="doc($url2)"/>

   <xsl:key name="k1" match="definition" use="term"/>

   <xsl:output indent="yes"/>

   <xsl:template match="cases">
     <derivations>
       <xsl:apply-templates select="section"/>
     </derivations>
   </xsl:template>

   <xsl:template match="section">
     <derivation>
       <xsl:value-of select="concat('Subsection ', content)"/>
       <xsl:apply-templates select="type"/>
       <xsl:value-of select="key('k1', tokenize(origin, ', '), 
$doc2)/def" separator=", "/>
     </derivation>
   </xsl:template>

   <xsl:template match="section/type[not(normalize-string)]">
     <xsl:text> replace, </xsl:text>
   </xsl:template>

   <xsl:template match="section/type[. = 'Drafting']">
     <xsl:text> was created in drafting, </xsl:text>
   </xsl:template>

   <xsl:template match="section/type[. = 'New']">
     <xsl:text> is a new provision, </xsl:text>
   </xsl:template>

</xsl:stylesheet>

creates the following result:

<derivations>
    <derivation>Subsection (1) replace, Finance Act</derivation>
    <derivation>Subsection (2) was created in drafting, Finance Act, 
Caravan Sites Act</derivation>
    <derivation>Subsection (3) is a new provision, Caravan Sites Act, 
Income and
Corporation Taxes Act</derivation>
</derivations>

The Subsection numbers are different from what you asked for but I could 
not see where those numbers in your posted output come from. If you 
can't fix the stylesheet yourself then please explain where those 
numbers come from.

-- 

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/



Confidentiality Notice:  This transmittal is a confidential communication.  If you are not the intended recipient, you are hereby notified that you have received this transmittal in error and that any review, dissemination, distribution or copying of this transmittal is strictly prohibited.  If you have received this communication in error, please notify this office immediately by reply and immediately delete this message and all of its attachments, if any.

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.