Forum Moderators: open
Sample:
<Alert Document_Name="Alerts" Document_Description="" Document_Version="1" Document_Time="29/11/2005 14:27:42" Document_Generator="c:\documents and settings\thorne\local settings\application data\assembly\dl2\9r6xkwdd.lqd\j8dpb2dv.9en\79d53564\00a83434_14afc501\psvdclient.dll">
<Item Kind="Alert" Title="Measures Missing Data">
<From>
<User Name="C: THorne" Email="THorne@example.com"/>
</From>
<To>
<User Name="C: THorne" Email="THorne@example.com"/>
</To>
<Header><![CDATA[The measures listed below require data entry.]]>
</Header>
<Item Kind="Section" Title="P: [AE] Selected Meas">
<Item Kind="Comparison" Title="Actual vs. Target"/>
<Item Kind="Period" Title="2005/10"/>
<Item Kind="Measure (Location)" Title="P: 05 # Readership Initiatives (Rockingham)">
<Item Kind="Index" Title="--"/>
</Item>
<Item Kind="Measure (Location)" Title="P: # Pg A1 Community Issues that Drive Rdrshp (Rockingham)">
<Item Kind="Index" Title="--"/>
</Item>
<Item Kind="Measure (Location)" Title="P: 05 # Error Reduction Processes (Rockingham)">
<Item Kind="Index" Title="--"/>
</Item>
<Item Kind="Measure (Location)" Title="P: 05 # Content Diversity Strategies (news) (Rockingham)">
<Item Kind="Index" Title="--"/>
</Item>
<Item Kind="Measure (Location)" Title="P: # Promo References (Rockingham)">
<Item Kind="Index" Title="--"/>
</Item>
<Item Kind="Measure (Location)" Title="P: % Last Page Deadline (Rockingham)">
<Item Kind="Index" Title="--"/>
</Item>
</Item>
</Item>
</Alert>
[edited by: jatar_k at 7:02 am (utc) on Dec. 1, 2005]
[edit reason] generalized email [/edit]
Here is my XML File:
<Alert Document_Name="Alerts">
<Item Kind="Alert" Title="Measures Missing Data">
<From>
<User Name="C: THorne" Email="THorne@example.com"/>
</From>
<To>
<User Name="C: THorne" Email="THorne@example.com"/>
</To>
<Header><![CDATA[The measures listed below require data entry.]]>
</Header>
<Item Kind="Section" Title="P: [AE] Selected Meas">
<Item Kind="Comparison" Title="Actual vs. Target"/>
<Item Kind="Period" Title="2005/10"/>
</Item>
</Item>
</Alert>
Here is my XSL file:
<xsl:for-each select="Alert">
<xsl:for-each select="Item">
<table border="2" height="#" table-layout="auto" width="#%">
<tr>
<td colspan="9">
<xsl:for-each select="@Title">
<span style="word-wrap: normal; font-weight: bold; font-family: verdana;">
<xsl:value-of select="." />
</span>
</xsl:for-each>
</td>
</tr>
<tr bgcolor="silver">
<td>Object Type</td>
<td>Name</td>
<td>Name</td>
<td>Name</td>
<td>Name</td>
</tr>
<xsl:for-each select="Item">
<tr>
<td>
<xsl:for-each select="@Kind">
<span style="word-wrap:normal; ">
<xsl:value-of select="." />
</span>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="@Title">
<span style="word-wrap:normal; ">
<xsl:value-of select="." />
</span>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="Item">
<xsl:for-each select="@Title">
<span style="word-wrap:normal; ">
<xsl:value-of select="." />
</span>
</xsl:for-each>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:for-each>
Any help would be greatly appreciated.
[edited by: jatar_k at 7:02 am (utc) on Dec. 1, 2005]
[edit reason] generalized email [/edit]
It's still a little hard to understand what you want, since <Item> appears at three different levels in the source. Incidentally your display may also be affected by the conflicting output code-- your specify colspan="9", then only provide five heading cells, then only output three actual data points.
But let's assume that you literally want everything inlined into a two-column HTML <table> for each <Alert>, using the @Title of the immediate child <Item> as a heading for the whole table regardless of its @Kind; discard the <Header>, <From> and <To> blocks; and display the @Kind and @Title of each descendant <Item> side by side. I'd try something like this:
<xsl:template match="Alert/Item">
<table>
<tr>
<th colspan="2">
<!-- outputs Alert/Item/@Title -->
<xsl:value-of select="@Title" />
</th>
</tr>
<!-- process the immediate child Item, which comprises the table data. -->
<xsl:apply-templates select="Item" />
</table>
</xsl:template>
<!-- process on anything named Item at any level -->
<xsl:template match="Item">
<tr>
<td><xsl:value-of select="@Kind" /></td><td><xsl:value-of select="@Title" /></td>
</tr>
<!-- we instruct the processor to do any child Items of the current Item -->
<xsl:apply-templates />
</xsl:template>
Using MSXML this yields
+-------------------------------------------------------------------+
¦ Measures Missing Data ¦
+---------------------+---------------------------------------------+
¦ Section ¦ P: [AE] Selected Meas ¦
+---------------------+---------------------------------------------+
¦ Comparison ¦ Actual vs. Target ¦
+---------------------+---------------------------------------------+
¦ Period ¦ 2005/10 ¦
+---------------------+---------------------------------------------+
¦ Measure (Location) ¦ P: 05 # Readership Initiatives (Rockingham) ¦
+---------------------+---------------------------------------------+
¦ Index ¦ -- ¦
+---------------------+---------------------------------------------+
etc
+---------------------+---------------------------------------------+
¦ Measure (Location) ¦ P: % Last Page Deadline (Rockingham) ¦
+---------------------+---------------------------------------------+
¦ Index ¦ -- ¦
+---------------------+---------------------------------------------+
<xsl:apply-templates select="Item[@Kind!='Index']" />
Thus the second template will not be applied to any <Item> whose Kind attribute has the value "Index," meaning the row will not be output.
<xsl:apply-templates select="Item" />
with:
<xsl:apply-templates select="Item[@Kind!='Index']" />
Could it be something to do with that the line that has the values for index are wrapped like so:
<Item Kind="Section" Title="C: [TH] Missing Data - Tampa">
<Item Kind="Comparison" Title="Actual vs. Target"/>
<Item Kind="Period" Title="2005/10"/>
<Item Kind="Measure (Location)" Title="P: 05 # Community Relations Initiatives (Tampa)">
<Item Kind="Index" Title="--"/>
</Item>
</Item>
I've gotten a long ways thanks to your help, here is what I have come up with so far:
<snip>
I'd just like to get the **No Measures Missing Data** line to display within the body of the table.
Thanks again!
[edited by: jatar_k at 3:52 am (utc) on Dec. 7, 2005]
[edit reason] removed url [/edit]