[xsl] splitting one xml into many xml documents using xsl

Subject: [xsl] splitting one xml into many xml documents using xsl
From: murali meraga <meraga_m@xxxxxxxxx>
Date: Fri, 9 Mar 2001 09:47:53 -0800 (PST)
Hi,

  Here is details about my problem. I have the
folloing adddress.xml document

<?xml version="1.0" encoding="UTF-8"?>
  <address_object>
       <address1>
           <name>x</name>
           <street>1925 x street</street>
           <city>x city</city>
           <zip>0000</zip>
       </address1>  
       <address2>
           <name>x</name>
           <street>1925 x street</street>
           <city>x city</city>
           <zip>0000</zip>
       </address2>  
       <address3>
           <name>x</name>
           <street>1925 x street</street>
           <city>x city</city>
           <zip>0000</zip>
       </address3>  
 </address_object>

and I want to split the above xml into the follwing
xml documents. How can I do that using xsl? 

------------address1.xml -------------
<?xml version="1.0" encoding="UTF-8"?>
<address1>
           <name>x</name>
           <street>1925 x street</street>
           <city>x city</city>
           <zip>0000</zip>
</address1>  

----------addrees2.xml --------
<?xml version="1.0" encoding="UTF-8"?>
<address2>
           <name>x</name>
           <street>1925 x street</street>
           <city>x city</city>
           <zip>0000</zip>
</address2> 
------------- address3.xml --------------------
<?xml version="1.0" encoding="UTF-8"?>
<address3>
           <name>x</name>
           <street>1925 x street</street>
           <city>x city</city>
           <zip>0000</zip>
</address3>   

Thanks in advance.





--- Michael Kay <mhkay@xxxxxxxxxxxx> wrote:
> I'm guessing, but I think it could be caused because
> there's been an
> incompatible change to some of the JAXP 1.1 classes
> since Saxon 6.2.1 was
> built. I'm planning to rebuild with the latest
> version in the next few days.
> Meanwhile, if Xerces is using a version that's
> incompatible with Saxon's
> version, you've got a problem.
> 
> Mike Kay
> Software AG
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On
> Behalf Of Julian F.
> > Reschke
> > Sent: 09 March 2001 15:35
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] Saxon 6.21 TRAX interface vs.
> Xerces
> >
> >
> > Hi,
> >
> > I am trying to use Saxon's TRAX interface to do a
> > transformation of XSLT/XML
> > residing in Xerces DOMs. My code looks like:
> >
> >   public String transform (Document doc)
> >   {
> >     try {
> >       String result = new String();
> >       TransformerFactory tfactory =
> TransformerFactory.newInstance();
> >
> >       // Make sure the TransformerFactory supports
> the DOM feature.
> >       if (tfactory.getFeature(DOMSource.FEATURE)
> &&
> > tfactory.getFeature(DOMResult.FEATURE))
> >       {
> > System.err.println
> (tfactory.getClass().getName());
> >         // Create the Templates from a DOM.
> >         DOMSource dsource = new
> DOMSource(m_transform,
> > "normalize.xslt");
> > System.err.println ("0");
> >         Templates templates =
> tfactory.newTemplates(dsource);
> > System.err.println ("1");
> >         Transformer transformer =
> templates.newTransformer();
> > System.err.println ("2");
> >         transformer.transform(new DOMSource(doc),
> new
> > StreamResult(result));
> > System.err.println ("3");
> >       }
> >
> >       System.err.println (result);
> >       return result;
> >     }
> >     catch (Exception e) {
> > System.err.println (e);
> > return null;
> >     }
> >
> > I'm getting down to
> >
> > System.err.println ("0");
> >
> > then, I get the following exception:
> >
> > java.lang.LinkageError: Class org/w3c/dom/Node
> violates
> > loader constraints
> > at java.lang.ClassLoader.defineClass0(Native
> Method) 	at
> >
>
java.lang.ClassLoader.defineClass(ClassLoader.java:486)
> 	at
> >
>
java.security.SecureClassLoader.defineClass(SecureClassLoader.
> > java:111) 	at
> >
>
java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
> 	at
> >
>
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> 	at
> >
>
java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> 	at
> > java.security.AccessController.doPrivileged(Native
> Method) 	at
> >
>
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> 	at
> >
>
java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> 	at
> >
>
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
> > 	at
> >
>
java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> 	at
> >
>
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
> > 	at
> > java.lang.ClassLoader.defineClass0(Native Method) 
> at
> >
>
java.lang.ClassLoader.defineClass(ClassLoader.java:486)
> 	at
> >
>
java.security.SecureClassLoader.defineClass(SecureClassLoader.
> > java:111) 	at
> >
>
java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
> 	at
> >
>
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> 	at
> >
>
java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> 	at
> > java.security.AccessController.doPrivileged(Native
> Method) 	at
> >
>
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> 	at
> >
>
java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> 	at
> >
>
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
> > 	at
> >
>
java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> 	at
> >
>
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
> > 	at
> >
>
com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerF
> > actoryImpl.jav
> > a:117)
> >
> > Any help appreciated :-)
> >
> > Julian
> >
> >
> >  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> >
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread