Subject: [xsl] Creating then using elements from xml table <row><entry> content? From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx> Date: Wed, 29 Oct 2003 13:25:45 -0500 |
Hi. I've not found any references for this and would appreciate some help. With what I've tried so far, I don't get errors BUT I don't get output either! My xml source (created using an xml authoring tool) contains the following: <tools_materials> <table><tgroup cols="2"> <?PubTbl tgroup dispwid="6.78in"?> <colspec colname="col1" colwidth="1.26*"/><colspec colname="col2" colwidth="0.74*"/> <tbody><row><entry>Tool/Material</entry> <entry>Part Number</entry></row> <row><entry>Operations Manual</entry><entry>092022-001</entry> </row><row><entry>Machine Management System</entry> <entry>10-MS30-1000-021</entry></row></tbody></tgroup></table> </tools_materials> In my stylesheet, I need to create parent/child elements from the table content (excluding row 1), ex: Column 1 = <tool_mat>Operations Manual Column 2 = <tool_partno>092022-001</tool_partno> </tool_mat> I then need to use those newly created elements in an html table. I have the following xsl (the first template is just my feeble attempt): <xsl:template match="tools_materials/table"> <!-- just trying to get the first element --> <xsl:for-each select="row[position() != 1]"> <xsl:element name="tool_mat"> <xsl:value-of select="normalize-space(cell[1])"/></xsl:element> </xsl:for-each> </xsl:template> <xsl:template match="tools_materials"> <table border="1" width="100%" cellpadding="4"> <tr bgcolor="orange" valign="middle"> <th colspan="3" align="left"> <h3>TOOLS AND MATERIALS</h3> </th> </tr> <tr> <td colspan="2"> <b>Tool/Material</b> </td> <td align="center"> <b>Jabil Part No.</b> </td> </tr> <xsl:apply-templates select="tools_materials/table"/> <xsl:apply-templates select="tool_mat"/> </table> </xsl:template> <xsl:template match="tool_mat"> <tr> <td align="left" valign="top" width="60%"> <table border="0"> <tr> <td align="left" valign="top"> <xsl:number level="single" format="1. " count="tool_mat" />  </td> <td align="left" valign="top"> <xsl:value-of select="." /> </td> </tr> </table> </td> <td align="left" valign="top" width="40%"> <xsl:apply-templates select="tool_partno"/> </td> </tr> </xsl:template> <xsl:template match="tool_partno"> <xsl:choose> <xsl:when test="text()"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise>NA</xsl:otherwise> </xsl:choose> <xsl:apply-templates select="tool_partno"/> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] namespaces problem, Michael Kay | Thread | RE: [xsl] Creating then using eleme, Passin, Tom |
Re: [xsl] Finding topmost element o, Wendell Piez | Date | Re: [xsl] logical operators in *tes, David Tolpin |
Month |