This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Building attributes using another template, context node?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Building attributes using another template, context node?
- From: "Manos Batsis" <m dot batsis at bsnet dot gr>
- Date: Thu, 25 Oct 2001 15:46:56 +0300
- Reply-To: xsl-list at lists dot mulberrytech dot com
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