Split XML files with XSLT and Java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nisargmca
    New Member
    • Jan 2010
    • 4

    Split XML files with XSLT and Java

    Hi All,
    I have below xml file...

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <T0020
    xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1">
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    and i want to split this xml file in multiple document using XSLT.

    Then i will apply xsl in Java Transformation as below...

    Code:
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xslSource = new StreamSource(xslFilePath);
    
    Transformer trans = tFactory.newTransformer(xslSource);
    trans.transform(new StreamSource(xmlFileName), new StreamResult(split xml files ));
    How can i do it ?

    Thanks in Advance.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you could pass a parameter to the XSLT stylesheet, telling it where to crop. though I don’t know how to do it in Java.

    Comment

    Working...