xsl-list
[Top] [All Lists]

Re: [xsl] Break output into files based on values

2006-09-26 22:46:04
Thangavelu Srinivasan wrote:
Hi All,
I need help in resolving the problem for the below. I am using XSLT 1.0.
Any suggestions are welcome.

My XML:
<root>
<DataComponent id="one">
      <DatasComponent>
        <p>This is a sample text</p>
      </DatasComponent>
</DataComponent>
<DataComponent id="two">
      <DatasComponent>
        <p>This is a sample text</p>
      </DatasComponent>
</DataComponent>
<DataComponent id="three">
      <DatasComponent>
        <p>This is a sample text</p>
      </DatasComponent>
</DataComponent>
</root>

Result I am Expecting:

Based on the id, it has save in the folder as a individual xml file
with their content.

Filename: one.xml

<DataComponent id="one">
      <DatasComponent>
        <p>This is a sample text</p>
      </DatasComponent>
</DataComponent>

Filename: two.xml
<DataComponent id="two">
      <DatasComponent>
        <p>This is a sample text</p>
      </DatasComponent>
</DataComponent>

My XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="doc" />
<xsl:template match="DataComponent">
<xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>



Thanks,
Srinivas

If your stuck with xslt 1.0 you can achieve this using extensions, look into http://www.exslt.org/exsl/elements/document/index.html on hot to use the exsl:document element.

I xslt 2.0 you can use the xsl:result-document element.

-- Jeff


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>