[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Automatically copying an element's attributes and thei
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
|
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
|