When converting XML into an HTML table, can I insert empty rows to make it more readable?

I've been asked to come up a with a simpler way of creating our packing lists, i.e. the list of items packed into each shipping crate.
The data from scanned bar codes goes into an XML file e.g:

<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='packnote.xsl'?>
<Note created="2015-07-28T11:26:52" customer="MM05">
      <Item box="10000" so="801120" part="P15401" qty="1"/>
      <Item box="10000" so="801120" part="P15405" qty="1"/>
      <Item box="10000" so="801153" part="P19204" qty="5"/>
      <Item box="10001" so="801153" part="P1014" qty="180"/>
      <Item box="10001" so="801153" part="P19054" qty="6"/>
      <Item box="10001" so="801153" part="P19004" qty="1"/>
      <Item box="10001" so="801153" part="P10033" qty="1"/>
      <Item box="10001" so="801153" part="P10034" qty="1"/>
      <Item box="10002" so="802464" part="P17003" qty="1"/>
      <Item box="10002" so="802905" part="P18876" qty="1"/>
      <Item box="10002" so="803085" part="P25236.20" qty="1"/>
      <Item box="10000" so="801487" part="P10033" qty="1"/>
      <Item box="10000" so="801487" part="P10034" qty="1"/>
      <Item box="10002" so="801487" part="P13255" qty="5"/>
      <Item box="10000" so="801891" part="P13640" qty="50"/>
      <Item box="10001" so="801891" part="P13640" qty="50"/>
      <Item box="10002" so="802441" part="P13253" qty="1"/>
</Note>
PackNote1.xml

After the transform:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml">
      <xsl:output method="html"/>
      <xsl:template match="/Note">
            <html>
                  <body>
                        <h2>
                              <img src="file://N:/Customer Group/Sales/Packing Notes/images/logotiny.png" align="center" alt="Logo"/>
CASE CONTENT LIST
                        </h2>
                        <h4>Customer:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<xsl:value-of select="@customer"/>
                        </h4>
                        <h4>Packing Date:&#160;<xsl:value-of select="substring-before(@created,'T')"/>
                        </h4>
                        <table border="1">
                              <thead>
                                    <tr bgcolor="#9acd32">
                                          <th style="text-align: left">&#160;Box Number&#160;</th>
                                          <th style="text-align: left">&#160;Part Number&#160;</th>
                                          <th style="text-align: center">&#160;Quantity&#160;</th>
                                          <th style="text-align: center">&#160;Sales Order&#160;</th>
                                    </tr>
                              </thead>
                              <tbody>
                                    <xsl:apply-templates>
                                          <xsl:sort select="@box" data-type="number"/>
                                          <xsl:sort select="@part" data-type="text"/>
                                    </xsl:apply-templates>
                              </tbody>
                        </table>
                  </body>
            </html>
      </xsl:template>
      <xsl:template match="Item">
            <tr>
                  <td>
                        <xsl:value-of select="@box"/>
                  </td>
                  <td>
                        <xsl:value-of select="@part"/>
                  </td>
                  <td style="text-align: center">
                        <xsl:value-of select="@qty"/>
                  </td>
                  <td style="text-align: center">
                        <xsl:value-of select="@so"/>
                  </td>
            </tr>
            <xsl:apply-templates/>
      </xsl:template>
</xsl:stylesheet>
packnote.xsl

...I get the required table:
HTML table view
Can anyone suggest a way of inserting a blank row between the box numbers (e.g. after the last item in box 10000, before the 1st item in box 10001 etc.)?
I'm new to XSLT & have been struggling with this for days now.
LVL 1
SysWarTechSysAdminAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
try:
                               <tbody>
                                    <xsl:apply-templates>
                                          <xsl:sort select="@box" data-type="number"/>
                                          <xsl:sort select="@part" data-type="text"/>
                                    </xsl:apply-templates>
                                   <tr><td>&#32;</td><td>&#32;</td><td>&#32;</td><td>&#32;</td></tr> <!-- use this if you want column divider lines -->
                              </tbody>

OR:
                               <tbody>
                                    <xsl:apply-templates>
                                          <xsl:sort select="@box" data-type="number"/>
                                          <xsl:sort select="@part" data-type="text"/>
                                    </xsl:apply-templates>
                                   <tr><td colspan="4">&#32;</td></tr><!-- use this for a "blank" row -->
                              </tbody>
SysWarTechSysAdminAuthor Commented:
Hi hielo,
Thanks for the quick response.
I tried your suggestion, but that gives me a an empty row at the end of the table.
Your suggestion
What I'd like is something similar but separating each change of box id
e.g. (created by editing the HTML output):
Intended result
hieloCommented:
Try:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:exsl="urn:schemas-microsoft-com:xslt" extension-element-prefixes="exsl">
      <xsl:output method="html"/>
      <xsl:template match="/Note">
            <html>
                  <body>
                        <h2>
                              <img src="file://N:/Customer Group/Sales/Packing Notes/images/logotiny.png" align="center" alt="Logo"/> 
CASE CONTENT LIST
                        </h2>
                        <h4>Customer:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<xsl:value-of select="@customer"/>
                        </h4>
                        <h4>Packing Date:&#160;<xsl:value-of select="substring-before(@created,'T')"/>
                        </h4>
                        <table border="1">
                              <thead>
                                    <tr bgcolor="#9acd32">
                                          <th style="text-align: left">&#160;Box Number&#160;</th>
                                          <th style="text-align: left">&#160;Part Number&#160;</th>
                                          <th style="text-align: center">&#160;Quantity&#160;</th>
                                          <th style="text-align: center">&#160;Sales Order&#160;</th>
                                    </tr>
                              </thead>
                              <tbody>
								<!-- store a copy of the sorted items in Notes variable -->
								<xsl:variable name="Notes"><xsl:apply-templates mode="sortedItems" select="//Note/Item"><xsl:sort select="@box"/></xsl:apply-templates></xsl:variable>
								
								<!-- apply-templates on the sorted items (node-set reference: http://www.xml.com/pub/a/2003/07/16/nodeset.html) -->
								<xsl:apply-templates select="exsl:node-set($Notes)/node()"/>
                              </tbody>
                        </table>
                  </body>
            </html>
      </xsl:template>
	  
	  <!-- used to store a copy of the sorted item into variable -->
	  <xsl:template match="Item" mode="sortedItems"><xsl:copy-of select="."/></xsl:template>

	  <!-- table row generated -->
      <xsl:template match="Item">
            <tr>
                  <td>
                        <xsl:value-of select="@box"/>
                  </td>
                  <td>
                        <xsl:value-of select="@part"/>
                  </td>
                  <td style="text-align: center">
                        <xsl:value-of select="@qty"/>
                  </td>
                  <td style="text-align: center">
                        <xsl:value-of select="@so"/>
                  </td>
            </tr>
			
			<xsl:if test="(string(following-sibling::Item/@box) !='') and (string(following-sibling::Item/@box) != string(@box))">
				<tr><td colspan="4">-</td></tr>
			</xsl:if>
            <xsl:apply-templates/>
      </xsl:template>
</xsl:stylesheet>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SysWarTechSysAdminAuthor Commented:
That is perfect.
Thankyou very much!

I can now see that I shouldn't have skipped through the XPath sections of the XSLT books I've been studying from.

A few hours on & I've had to make one small change to allow Firefox to perform on-the-fly transformations - I've changed the namespace to "http://exslt.org/common"
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.