The above creates a single invoice line, not one per each following
sibling.
For help on "the start template statements etc." most XSLT books
discuss the top-level requirements for stylesheets. There is a free
download on our web site of the first two chapters and all other
chapter introductions of the XSLT book we sell from our web site ...
you can see working examples there. Check the links at the right
side of our home page linked blow. There are also many web sites
with introductory information on XSLT.
For the wrapping bit, I hope the code below helps.
. . . . . . . . . . Ken
T:\ftemp>type peter.xml
<invoices>
<invoiceHeader> ...</invoiceHeader>
<invoiceLine>... </invoiceLine>
<invoiceLine>... </invoiceLine>
<invoiceLine>... </invoiceLine>
<invoiceHeader>... </invoiceHeader>
<invoiceLine>... </invoiceLine>
<invoiceLine>... </invoiceLine>
</invoices>
T:\ftemp>type peter.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="invoices">
<invoices>
<xsl:for-each select="invoiceHeader">
<invoice>
<invoiceHeader><xsl:value-of select="."/></invoiceHeader>
<xsl:for-each select="following-sibling::invoiceLine[
count(preceding-sibling::invoiceHeader[1] | current())
= 1]">
<xsl:copy-of select="."/>
</xsl:for-each>
</invoice>
</xsl:for-each>
</invoices>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>xslt peter.xml peter.xsl con
<?xml version="1.0" encoding="utf-8"?>
<invoices>
<invoice>
<invoiceHeader> ...</invoiceHeader>
<invoiceLine>... </invoiceLine>
<invoiceLine>... </invoiceLine>
<invoiceLine>... </invoiceLine>
</invoice>
<invoice>
<invoiceHeader>... </invoiceHeader>
<invoiceLine>... </invoiceLine>
<invoiceLine>... </invoiceLine>
</invoice>
</invoices>