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

RE: Access XML from the URL and put in different file

Subject: RE: Access XML from the URL and put in different file
From: Shashank Jain <shashankjain@xxxxxxxx>
Date: Wed, 13 Apr 2011 12:22:56 -0500
RE:  Access XML from the URL and put in different file
===Plain text===

Hello All,

 

Following is the test xml I am working on

 

<Description>

      <core
resource="http://xyz.com/93034B4E-5686-4FF5-9EAD-F603F42B897F/viewas/xml"/>

      <core
resource="http://xyz.com/E4E0EF48-030F-4ACE-B15E-E923AC582A6B/viewas/xml"/>

      <core
resource="http://xyz.com/9808A0E2-5678-435F-8C89-5B7C8C27E380/viewas/xml"/>

      <core
resource="http://xyz.com/80E137ED-E8CC-4B14-AC47-E437D8E91BBA/viewas/xml"/>

      <core
resource="http://xyz.com/97337AAC-81CF-4DD8-9C8F-B06744B13753/viewas/xml"/>

      <core
resource="http://xyz.com/114F7C46-C207-49BE-96D1-B5E4314342B9/viewas/xml"/>

<Description>

 

The value of resource attribute is a link to the XML
document.

I need to write an XSLT which creates 6 different output
file (as there are 6 <core>), and every output file should have their
respective XML.

 

=========

This is the test.xslt I wrote

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions">

      <xsl:output
method="xml" version="1.0" encoding="UTF-8"
indent="yes" name="xml"/>

      <xsl:template
match="/">

            <xsl:for-each
select="//core">

                  <xsl:variable
name="filename"
select="concat('output1/',substring(substring-after(@*:resource,'xyz.com/'),1
,5),'.xml')"/>

                  <xsl:value-of
select="$filename"/>

                  <!--
Creating  -->

                  <xsl:result-document
href="{$filename}" format="xml">

                        <xsl:value-of
select="@*:resource"/>

                  </xsl:result-document>

            </xsl:for-each>

      </xsl:template>

</xsl:stylesheet>

===========

I was able to get 6 different xml files, but they were
having the value of the respective resource attribute, not the whole XML.

 

 

Output

========

<?xml version="1.0"
encoding="UTF-8"?>

http://xyz.com/93034B4E-5686-4FF5-9EAD-F603F42B897F/viewas/xml

 

Required output is to get the whole XML, which appears
when the link is clicked/navigated.

 

Is there any way I can achieve this using XSLT.

 

Thanks,

Shashank Jain
----------------------------------------
> From: shashankjain@xxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Date: Wed, 13 Apr 2011 12:15:39 -0500
> Subject:  Access XML from the URL and put in different file
>
>
> Hello All,
> Following is the test xml I am working on
>
> The value of resource attribute is a link to the XML document. I need to
write an XSLT which creates 6 different output file (as there are 6 ), and
every output file should have their respective XML.
> =========This is the test.xslt I wrote           ===========I was able to
get 6 different xml files, but they were having the value of the respective
resource attribute, not the whole XML.
>
>
Output========http://xyz.com/93034B4E-5686-4FF5-9EAD-F603F42B897F/viewas/xml
> Required output is to get the whole XML, which appears when the link is
clicked/navigated.
> Is there any way I can achieve this using XSLT.
> Thanks,Shashank Jain

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.