[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: getting Not well formed xslt output
Yogesh:
This is a job for the step-wise identity stylesheet. (It appears in the XSLT spec, section 7.5.) <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> Basically this traverses the tree one node at a time, copying each node to output. Add to this two templates, one that handles your 'DEST' attribute, and one that handles your 'imtask' attribute (since these are the only things in your input that are going to change). <xsl:template match="@DEST"> <xsl:copy> <xsl:value-of select="../@imtask"/> </xsl:copy> </xsl:template> <xsl:template match="@imtask"/> The first copies the DEST attribute, except it takes the value of the same element's 'imtask' attribute for its value. The second removes the 'imtask' attribute. Both of these templates have a higher priority than the generic identity template, so will apply where they can. The technique, or pattern, is very useful for such simple "scrub transforms" as yours. I'm sure it's described in the FAQ. Since it's based on the identity transform, your problem of knowing how many attributes there are, and which, simply goes away. Good luck, Wendell BTW -- how'd this thread get its Subject line? It's basically useless: this has nothing to do with well-formedness. At 04:23 PM 7/10/01, you wrote: Hi Mike, I have one problem like this: my node is like this: <ACTION TYPE="accept" LABEL="Next" task="go" DEST="#password" > ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== 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
|