Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does the for-each not work consistently?
    primarykey
    data
    text
    <p>When I use </p> <pre><code>&lt;xsl:for-each select="plm:PLMXML/plm:ProductRevision&gt; </code></pre> <p>and the value-of as in</p> <pre><code>&lt;td&gt;&lt;xsl:value-of select="plm:UserData/plm:UserValue[1]/@value"/&gt;&lt;/td&gt; </code></pre> <p>follows the web page I am forming with the xsl works perfectly. But when I use</p> <pre><code>&lt;xsl:for-each select="plm:PLMXML&gt; </code></pre> <p>and a value-of as in</p> <pre><code>&lt;td&gt; &lt;xsl:value-of select="plm:ProductRevision/plm:UserData/plm:UserValue[1]/@value"/&gt; &lt;/td&gt; </code></pre> <p>the web page I am creating is no longer formed properly.</p> <p>In the first case the htm is output like this:</p> <pre><code>&lt;body&gt; &lt;h2&gt;My CD Collection&lt;/h2&gt; &lt;table border="1"&gt; &lt;tr bgcolor="#9acd33"&gt; &lt;th&gt;Category Type&lt;/th&gt; &lt;th&gt;DS Def. Modified?&lt;/th&gt; &lt;th&gt;DS Def Verified?&lt;/th&gt; &lt;th&gt;Designation&lt;/th&gt; &lt;th&gt;Hazardous&lt;/th&gt; &lt;th&gt;test column&lt;/th&gt; &lt;th&gt;Make/Buy&lt;/th&gt; &lt;th&gt;Packaging&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;Make&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;Make&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This is just as it should be. There will be two rows in an htm table. The following is output from the second scenario where all I have done is taken <code>plm:ProductRevision</code> from the <code>for-each</code> select value and appended it to the beginning of the <code>value-of</code> select statement. The two should be synonymous shouldn't it? Here is the output when that is done.</p> <pre><code>&lt;html xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema" xmlns:plmxml_cl="http://www.plmxml.org/Schemas/PLMXMLClassificationSchema"&gt; &lt;body&gt; &lt;h2&gt;My CD Collection&lt;/h2&gt; &lt;table border="1"&gt; &lt;tr bgcolor="#9acd33"&gt; &lt;th&gt;Category Type&lt;/th&gt; &lt;th&gt;DS Def. Modified?&lt;/th&gt; &lt;th&gt;DS Def Verified?&lt;/th&gt; &lt;th&gt;Designation&lt;/th&gt; &lt;th&gt;Hazardous&lt;/th&gt; &lt;th&gt;test column&lt;/th&gt; &lt;th&gt;Make/Buy&lt;/th&gt; &lt;th&gt;Packaging&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt;Make Make&lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Please help me understand why. The reason I need to do the second way is I have values from nodes which differ under the parent node of plm:PLMXML. In other words I have values under plm:PLMXML/plm:ProductRevision and under plm:PLMXML/plmxml_cl:ICO so I want to use </p> <pre><code>&lt;xsl:for-each select="plm:PLMXML&gt; &lt;tr&gt; &lt;td&gt; &lt;xsl:value-of select="plm:ProductRevision/plm:UserData/plm:UserValue[2]/@value"/&gt; &lt;/td&gt; &lt;td&gt; &lt;xsl:value-of select="plmxml_cl:ICO/plmxml_cl:Property[@attributeId='3000011']/plmxml_cl:Value"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/for-each&gt; </code></pre> <p>However as shown above it does not output the desired code. Anything anyone can do to help me understand this would be greatly appreciated. If any additional information is required please advise and I will supply it immediately. Thank you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload