[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: trouble looping using xsl:for-each and xsl:if
Miller, Mark wrote:
I have gone round and round on this problem and seem to be getting The xsl:if does not change the context node so you will need to select the relationship you are interested in into a variable and then use that variable to populate your table cells: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" encoding="iso-8859-1"/> <xsl:template match="ematrix"> <html> <body> <table border='1'> <tr> <th>Name</th> <th>B</th> <th>C</th> <th>L</th> </tr> <xsl:for-each select="businessObject"> <xsl:sort select="objectName"/> <tr> <td nowrap='nowrap'><xsl:value-of select="objectName"/></td> <td> <xsl:variable name="rs" select="fromRelationshipList/relationship[relationshipDefRef = 'Subordinate Submittal' and attributeList/attribute[name='Responsible IPT']/string = 'BMC4I']"/> <xsl:if test="$rs"> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Due Customer']/datetime,1,10)"/></p> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Promise Date']/datetime,1,10)"/></p> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Submitted Date']/datetime,1,10)"/></p> </xsl:if> </td> <td> <xsl:variable name="rs" select="fromRelationshipList/relationship[relationshipDefRef = 'Subordinate Submittal' and attributeList/attribute[name='Responsible IPT']/string = 'CMR']"/> <xsl:if test="$rs"> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Due Customer']/datetime,1,10)"/></p> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Promise Date']/datetime,1,10)"/></p> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Submitted Date']/datetime,1,10)"/></p> </xsl:if> </td> <td> <xsl:variable name="rs" select="fromRelationshipList/relationship[relationshipDefRef ='Subordinate Submittal' and attributeList/attribute[name='Responsible IPT']/string = 'LAUNCHER']"/> <xsl:if test="$rs"> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Due Customer']/datetime,1,10)"/></p> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Promise Date']/datetime,1,10)"/></p> <p><xsl:value-of select="substring($rs/attributeList/attribute[name='Submitted Date']/datetime,1,10)"/></p> </xsl:if> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|