Subject: RE: [xsl] Number of scans required ?? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 15 Aug 2003 17:52:17 -0400 |
Agent Name,Install Path,Product Version,Build Number
<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="//ROW"/> <!-- this apply-templates could be written to be more efficient, but I'm too lazy --> </xsl:template>
<xsl:template match="ROW"> <!-- 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/COLUMN[@NAME=current()]"/> <xsl:if test="not(position()=last())">,</xsl:if> </xsl:for-each> <xsl:text>
</xsl:text><!-- line feed for legibility --> </xsl:template>
I hope that helps, Wendell
As all of you gurus are saying that it is possible, then it must be. May be i am not able to find the proper solution for it.
As michael said I want exactly that. Header descrbing the column name and data
for that column names will follow. But there can be situation like same table
will have m columns at one place and n columns at another place in the input.
Below is the simulated input xml file. ====================================
<?xml version="1.0" encoding="UTF-8"?>
<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>
================================================================
And i m trying to get output something like this
Agent Name,Install Path,Product Version,Build Number eXpress NS Client,,5.5.0.517,517 eXpress Inventory Solution,,5.5.0.424,424 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
====================================================================
As of now i have shown that there is only one table and columns within it. There are other tables also but to make things simple i have shown only one table withn tables tag. I was not able to produce the desired output.
I hope with these as input and output there should be some way to get the above mentioned output.
Thanks a lot to all you gurus for taking out your time to read my problem.
Eagerly waiting for reply.
Regards, Dipesh
PS: Resending this email since from yesterday i have not recieved any digest.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
====================================================================== 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Number of scans required , Dipesh Khakhkhar | Thread | RE: [xsl] Number of scans required , Dipesh Khakhkhar |
[xsl] xslt newbie- inserting spaces, Bruce Rojas-Rennke | Date | Re: [xsl] xslt newbie- inserting sp, Wendell Piez |
Month |