[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Building attributes using another template, contex

Subject: RE: Building attributes using another template, context node?
From: "Manos Batsis" <m.batsis@xxxxxxxx>
Date: Thu, 25 Oct 2001 15:46:56 +0300
building attributes
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.