#1
  1. cave painting, the 1st Opn Src
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0

    For-each question


    Code:
      <h2>Printers</h2>
      <table border="1">
        <tr bgcolor="#9acd32">
          <th>Printers</th>
          <th>Info</th>
        </tr>
     		<xsl:for-each select="SEC/SECCLASS/ATTR/AttrType='PRT'">   
       			<tr>
          			<td>>><xsl:value-of select="SEC/SECCLASS/ATTR/AttrName"/></td>
        			</tr>
         		</xsl:for-each>   
      </table>
      </body>
      </html>
    I'm trying to get an element, AttrName, based on the AttrType's that equal PRT.

    if I remove ='PRT' from the AttrType node I get an empty row for each item, but not the attribute.

    So, I have two errors in this syntax.
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    191
    Rep Power
    49
    show die xml orignal file
    Helmut Hagemann Germany

    fallen to the bottom of the facts?
    I reach my hand and we go together


    wer lesen und google kann ist klar im Vorteil
    who read and google is able is clear in the advantage
  4. #3
  5. cave painting, the 1st Opn Src
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0
    Code:
    <SEC>
      <SECCLASS >
       <ATTR>
        <AttrType>ENV</AttrType>
        <AttrName>PROD</AttrName>
       </ATTR>
      </SECCLASS>
      <SECCLASS>
        <ATTR>
         <AttrType>PRT</AttrType>
         <AttrName>tr_001</AttrName>
       </ATTR>
      </SECCLASS>
      <SECCLASS>
        <ATTR>
         <AttrType>PRT</AttrType>
         <AttrName>tr_002</AttrName>
       </ATTR> 
     </SECCLASS>
      <SECCLASS>
        <ATTR>
         <AttrType>ITEM</AttrType>
         <AttrName>class</AttrName>
       </ATTR> 
     </SECCLASS>
    <SEC>
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    191
    Rep Power
    49
    not for use each
    and css so that the template is readable

    Code:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes" method="html"/>
    	<xsl:template match="/">
    		<html>
    		<style type="text/css">
    		table
    		{
    		border:solid 1px black;
    		}
    		th,td
    		{
    		border:solid 1px black;
    		}
    		.head
    		{
    		background-color:#9acd32;
    		}
    		</style>
    			<body>
    				<h2>Printers</h2>
    				<table>
    					<tr class="head">
    						<th>Printers</th>
    						<th>Info</th>
    					</tr>
    					<xsl:apply-templates select="SEC"/>
    				</table>
    			</body>
    		</html>
    	</xsl:template>
    	<xsl:template match="SEC">
    		<xsl:apply-templates select="SECCLASS[AttrType = 'PRT']"/>
    	</xsl:template>
    	<xsl:template match="SECCLASS">
    		<tr>
    			<td>
    				<xsl:value-of select="AttrType"/>
    			</td>
    			<td>
    				<xsl:value-of select="AttrName"/>
    			</td>
    		</tr>
    	</xsl:template>
    </xsl:stylesheet>
    result
    Code:
    <html>
      <style type="text/css">
    		table
    		{
    		border:solid 1px black;
    		}
    		th,td
    		{
    		border:solid 1px black;
    		}
    		.head
    		{
    		background-color:#9acd32;
    		}
    		
      </style>
      <body>
        <h2>Printers</h2>
        <table>
          <tr class="head">
            <th>Printers</th>
            <th>Info</th>
          </tr>
          <tr>
            <td>PRT</td>
            <td>tr_001</td>
          </tr>
          <tr>
            <td>PRT</td>
            <td>tr_002</td>
          </tr>
        </table>
      </body>
    </html>
    Helmut Hagemann Germany

    fallen to the bottom of the facts?
    I reach my hand and we go together


    wer lesen und google kann ist klar im Vorteil
    who read and google is able is clear in the advantage
  8. #5
  9. cave painting, the 1st Opn Src
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0
    Thank you,
    That is far more complex than I thought.
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com

IMN logo majestic logo threadwatch logo seochat tools logo