[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Number of scans required ??


Subject: Re: [xsl] Number of scans required ??
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 14 Aug 2003 15:34:20 +0100

> As of now i have shown that there is only one table 

the test file you showed appeared to have two tables,
The output below doesn't quite match what you said you want but I
couldn't see how your requested output related to your input.

input xml

<Root>
<Tables>
<TABLE NAME="Client_Agent">
  <ROW>
    <COLUMN NAME="Agent Name">eXpress NS Client</COLUMN>
    <COLUMN NAME="Product Version">5.5.0.517</COLUMN>
    <COLUMN NAME="Build Number">517</COLUMN>
  </ROW>

  <ROW>
     <COLUMN NAME="Agent Name">eXpress Inventory Solution</COLUMN>
     <COLUMN NAME="Product Version">5.5.0.424</COLUMN>
     <COLUMN NAME="Build Number">424</COLUMN>
  </ROW>
</TABLE>



<TABLE NAME="Client_Agent">
  <ROW>
    <COLUMN NAME="Agent Name">eXpress NS Client</COLUMN>
    <COLUMN NAME="Install Path">C:\Program Files\ABC\eXpress\NS 
Client\Software Delivery\Software 
Packages\{01B54EB5-3679-4C73-9E10-E169D5EA8C59}</COLUMN>
    <COLUMN NAME="Product Version">5.5.0.519</COLUMN>
    <COLUMN NAME="Build Number">519</COLUMN>

  </ROW>

  <ROW>
     <COLUMN NAME="Agent Name">eXpress Inventory Solution</COLUMN>
     <COLUMN NAME="Install Path">C:\Program Files\ABC\eXpress\NS      
Client\Software Delivery\Software 
Packages\{01B54EB5-4579-4C73-9E10-E169D5DA9E59}</COLUMN>
     <COLUMN NAME="Product Version">5.5.0.428</COLUMN>
     <COLUMN NAME="Build Number">428</COLUMN>
  </ROW>
</TABLE>
</Tables>
</Root>


xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="text"/>


<xsl:template match="TABLE">
<xsl:for-each select="ROW[1]/COLUMN/@NAME">
  <xsl:value-of select="."/>
  <xsl:if test="position()!=last()">,</xsl:if>
</xsl:for-each>
<xsl:text>&#10;</xsl:text>
<xsl:for-each select="ROW">
  <xsl:for-each select="COLUMN">
    <xsl:value-of select="normalize-space(.)"/>
    <xsl:if test="position()!=last()">,</xsl:if>
  </xsl:for-each>
  <xsl:text>&#10;</xsl:text>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>


result


Agent Name,Product Version,Build Number
eXpress NS Client,5.5.0.517,517
eXpress Inventory Solution,5.5.0.424,424




Agent Name,Install Path,Product Version,Build Number
eXpress NS Client,C:\Program Files\ABC\eXpress\NS Client\Software Delivery\Software Packages\{01B54EB5-3679-4C73-9E10-E169D5EA8C59},5.5.0.519,519
eXpress Inventory Solution,C:\Program Files\ABC\eXpress\NS Client\Software Delivery\Software Packages\{01B54EB5-4579-4C73-9E10-E169D5DA9E59},5.5.0.428,428




________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords