Re: Creating sveral pages while maintaining consistent
jody@xxxxxxxxxxxx wrote: > Is it possible to create different output pages > from one or more XML such that the numbering > of, for instance, sections stays consistent > throughout the output. > > If the source is only one XML file, one could > insert certain markers (in an html-output this > could be a </html> followed by a <html>) > > But if various XML files are the input > (a situation which occurs if several people > work on different parts of a document) > i don't even know how to tell the xslt processor > it has to take into account several input files. > > Again a low-tech solution which i thought of > consists of a preprocessing step in which > the input files are merged before processing them... Various XML files as input: <xsl:variable name="doc0" select="/"/> <!--main input--> <xsl:variable name="doc1" select="document('doc1.xml')"/> <xsl:variable name="doc2" select="document('doc2.xml')"/> <xsl:variable name="doc3" select="document('doc3.xml')"/> $doc1 is the root node of doc1.xml, $doc2 is the root node of doc2.xml, and so on. You can merge them using the union operator, "|". <xsl:variable name="all" select="$doc1|$doc2|$doc3"/> $all is now the root node of all 3, as if they were one big general entity (I can't say "document" because it wouldn't be well-formed, having possibly 3 different element children of the root node). One caveat: in a union you may not be able to accurately predict the order of nodes coming from different documents. One XSLT processor may make $doc1's document element precede $doc2's, while another may have them in the opposite order, for example. Regarding creating different output pages with consistent numbering, you'll probably want to iterate over the nodes from $all that will start each section, then inside that 'loop' you will get the rest of the nodes you need for that section. At the point where you generate a number, you have to think about how to calculate that number based on what you know right then.. without seeing your code it's hard to say, but it will probably be based on the position() of the node that started the section, relative to all the nodes that started the sections. There are many examples of grouping and numbering in the FAQ at http://www.dpawson.co.uk and also some good stuff at http://www.jenitennison.com - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format