Forum Moderators: open
I want, in XSL, to create a new HTM file for every "row".
I found a possible solution usin XALAN parser and the 'File' function. So I did some investigation and downloaded the XERCES processor believin that it was packaged with XALAN (as it says at Apache) but I'm Saddam Husseins future cell-mate if I can suss whether it has in fact, got XALAN with it - Java, can't stand it! - or even whether I've installed it correctly.
So, lookin for two possible answers; Can it be done in XSL on its own? If not, some straightforward guidance on installin and/or workin with XERCES/XALAN appreciated.
see 'Feature 2: Multiple Outputs' from Five XSLT 2.0 Features [oracle.com]
which suggests a dynamic filename example.
and then maybe use <xsl:for-each select="document/row"> instead of grouping.. but then the for-each-group is worth looking at.. it's not something I'm familar with.
<added/>
This should work.. but I've not got a processor to check.
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:for-each select="document/row">
<xsl:result-document href="../output/row{position()}.htm">
<html>
<body>
<xsl:copy-of select="*"/>
</body>
</html>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
<xsl:template match="text()¦@*"/>
</xsl:stylesheet>
HTH
I did however, find multixmltextwriter [msdn.microsoft.com] over at msdn which I'm hacking and making good progress with (Actually, there's some interestin downloads over there).
davidpbrown:
That looks interesting, will check it out thanks.
macrost:
What type of server are you on?
If I read the post correct, you want to be able to create and save a new html file from an xml document right?
Almost - I want to generate multiple html files from the siblings of the "Row" nodes contained within one XML file.
EG:
Document
-> Row (One HTML file)
-> -> Name
-> -> Another-Name
-> -> Blah...
-> /Row
-> Row (Another HTML file)
-> -> Name
-> -> Another-Name
-> -> Blah...
-> /Row
etc..
/Document