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

Automatically copying an element's attributes and thei

Subject: Automatically copying an element's attributes and their values
From: Mary McRae <marymcrae@xxxxxxxxxxxxx>
Date: Sun, 07 Sep 2003 16:13:23 -0400
w pstyle
I would like to pass through attributes and their
values without having to a) test to see if the
attribute has a value specified, and b) explicitly
output the value.

This is the code I'm currently using:

	<xsl:template match="ns0:para"
mode="blockindent">
		<xsl:choose>
			<xsl:when test="@id">
				<ns0:para
id="{@id}">
					<w:p>
	
<w:pPr>
	
<w:pStyle w:val="Blockindent"/>
	
</w:pPr>
	
<xsl:apply-templates mode="para"/>
					</w:p>
				</ns0:para>
			</xsl:when>
			<xsl:otherwise>
				<ns0:para>
					<w:p>
	
<w:pPr>
	
<w:pStyle w:val="Blockindent"/>
	
</w:pPr>
	
<xsl:apply-templates mode="para"/>
					</w:p>
				</ns0:para>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>


I tried using the code submitted by Mike Brown in
Dave Pawson's FAQ:

<ns0:para>
	<xsl:for-each select="@*">
      	<xsl:attribute name="name()">
			<xsl:value-of select="."/>
		</xsl:attribute>
    </xsl:for-each>
... Remainder of template

But using MSXML 3.0 in XMLSpy and Xselerator I got
an error "This name may not contain the '('
character: name-->(<--); if I use the default XSLT
processor in XMLSpy I don't get an error, but the
attributes do not appear in my result file. The
final transform will end up being performed using
MSXML.

It should also be noted that my source instance
does not contain namespace prefixes (i.e.
<para>asd;fljk adsflkjsda f</para>
<para id="1234">adlfkj</para>)

Thanks in advance,

Mary



 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.