[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Building attributes using another template, contex
Thanks for the reply Jarno, I just can't manage producing the attribute using another template. What's wrong? Here are the revised (and more accurate, I didn't paste the actual markup on the previous message) XSL and XML fragments: <!-- scrap elements --> <xsl:template match="TABLE[@class='element']"> <xsl:element name="{TBODY/TR/TD[@class='elemType']/P/text()}"> <xsl:for-each select="TBODY/TR/TD[@class='childHolder']/DIV/TABLE[@class='attribute']" > <xsl:apply-templates select="node()" mode="scrapAttrs"/> </xsl:for-each> <xsl:apply-templates/> </xsl:element> </xsl:template> <!-- scrap attrs --> <xsl:template name="scrapAttrs" mode="scrapAttrs" match="TABLE[@class='attribute']"> <xsl:attribute name="{TBODY/TR/TD[@class='attrName']/P/text()}"> <xsl:value-of select="TBODY/TR/TD[@class='attrValue']/P/text()"/> </xsl:attribute> </xsl:template> And the input XML fragment: <TABLE class="element" cellSpacing="0" cellPadding="0"> <TBODY> <TR> <TD class="buttonHolder"> <BUTTON class="shown"> </BUTTON> </TD> <TD class="elemType"> <P class="elemNameTextArea"> xsl:stylesheet </P> </TD> <TD class="childHolder"> <DIV class="hide"> <TABLE class="attribute" cellSpacing="0" cellPadding="0"> <TBODY> <TR> <TD class="buttonHolder"> <BUTTON class="hidden"> </BUTTON> </TD> <TD class="attrName"> <P class="elemAttrTextArea"> version </P> </TD> <TD> <P class="attrValue" areaType="attrValue"> 1.0 </P> </TD> </TR> </TBODY> </TABLE> </DIV> </TD> </TR> </TBODY> </TABLE> Kindest regards, Manos XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|