|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Column Heads and Column Data problem ??
Dipesh,
I am afraid I don't have time at this point to dig into your problem. I did, however, run your sample input through the stylesheet I offered a couple of days ago. After a bug fix (broken XPath) and adjustment for your element names, this is the output I got (line breaks added for legibility): [start] Computer,ALTIRISTEST_CPQ,Name,Domain,Altkey1,Altkey2,Client_Agent,Agent Name,Product Version,Build Number,Install Path,Inventory_Results,Collection Time,File Count,Total Size,Version ,,,,,,,Altiris eXpress NS Client,5.5.0.517,517,C:\Program Files\Altiris\eXpress\NS Client,,,,, ,,,,,,,Altiris eXpress Inventory Solution,5.5.0.424,424,C:\Program Files\Altiris\eXpress\NS Client\Software Delivery\Software Packages\{01B54EB5-3679-4C73-9E10-E169D5A5EC59},,,,, ,,,,,,,,,,,,1/9/2003 3:06:56 AM,3,139271,5: 5: 0: 423 [end] This isn't the output you've asked for, of course (it answers the problem statement of a couple of days ago), *but* ... it is close enough to suggest to me the solution I offered is on the right track, and that you can modify its approach and get what you want out of it. So ... what follows isn't an entire solution -- but if you figure how how it does what it does, you should have some hints on how to proceed. (Note on process: the XPath bug I had to fix to get this to work is an indication of the risks of trying to apply entire solutions provided on the list. Sometimes we do this, as the most expedient approach to our goal of addressing a posted problem, but as Mike Kay said yesterday, it's not really the best way to help you solve your problem. Rather, you have to dig in to what we provide -- whether it be code, or merely hints -- and *understand* how it applies, or why it's buggy.) Briefly stated, what the stylesheet does is collect all unique values of @NAME attributes and output, for each record, the values corresponding to the entire set of NAMES, delimited by commas: <xsl:output method="text"/> <xsl:variable name="name-set" select="//@NAME[not(.=preceding::*/@NAME)]"/> <xsl:template match="/">
<xsl:for-each select="$name-set">
<xsl:value-of select="."/>
<xsl:if test="not(position()=last())">,</xsl:if>
</xsl:for-each>
<xsl:text>
</xsl:text><!-- line feed for legibility --> <xsl:apply-templates select="//OBJECT"/>
<!-- this apply-templates could be written to be more efficient,
but I'm too lazy -->
</xsl:template><xsl:template match="OBJECT">
<!-- we bind our context node to a variable so we can get
to it inside the for-each -->
<xsl:variable name="this-row" select="."/>
<!-- Now we put out whatever value we have for each node in our name set -->
<xsl:for-each select="$name-set">
<xsl:value-of select="$this-row/ATTRIBUTE[@NAME=current()]"/>
<xsl:if test="not(position()=last())">,</xsl:if>
</xsl:for-each>
<xsl:text>
</xsl:text><!-- line feed for legibility -->
</xsl:template>Good luck, Wendell At 11:36 PM 8/19/2003, you wrote: Input ====== ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== 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
|

Cart








