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

RE: Extracting data from external file

Subject: RE: Extracting data from external file
From: "Joga Singh Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Mon, 31 Aug 2009 15:45:52 +0530
RE:  Extracting data from external file
I want to read value of attribute @n and open its corresponding file. If
value of @n is equal to value of @a than extract the value of child of the
element i.e <y>. Currently the file is load twice. Can we clear that buffer
before loading to another file because it is possible that there may be
differenal external file for every elememt <b>.


-----Original Message-----
From: Jingjun Long [mailto:longjingjun@xxxxxxxxx]
Sent: Monday, August 31, 2009 3:33 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Extracting data from external file

By looking into the example data you provided, file_ext.xml is loaded twice.
Your current output is exactly reflect your logic in the XSLT code.

There are many ways to get your expected output but what logic are you going
to put there.


2009/8/31 Joga Singh Rawat <jrawat@xxxxxxxxxxxxxx>:
> Hi,
> I want to extract data from external file i.e. file_ext.xml but not
> getting the required OUTPUT. Can anyone correct me about my mistake.
>
> dir/file_ext.xml
> <xxx>
>  <x a="file_1">
>    <y>first</y>
>  </x>
>  <x a="file _2">
>    <y>second</y>
>  </x>
> </xxx>
>
> b.xml
> <aaa>
>  <b n="file_1">
>  <b n="file_2">
> </aaa>
>
> XSLT Code
> <xsl:template match="b">
>  <xsl:variable name="a" select="substring-before(@n, '_')"/>
>  <xsl:variable name="file" select="document(concat('dir/', $a,
> '_ext.xml'))"/>
>   <found><xsl:value-of select="$file/xxx/x[@a = @n]/y"/></found>
> </xsl:template>
>
> OUTPUT
> <found>first second</found>
> <found>first second</found>
>
> Required OUTPUT
> <found>first</found>
> <found>fsecond</found>
>
> Thanks

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-2011 All Rights Reserved.