[XSL-LIST Mailing List Archive Home]
Re: Newbie: How to write a stylesheet that preserves the input tree
Subject: Re: Newbie: How to write a stylesheet that preserves the input tree |
From: Francois Belanger <francois@xxxxxxxxxxx>
Date: Thu, 10 Dec 98 14:00:04 -0500
(I did not get any answer to this but found it by looking at XT source.
Tought some members would be interested.)
Francois Belanger wrote on 02/12/98 10h45:
>Using the current XSL Draft as well as James Clark XT, I'm trying to
>preserve the attributes and node names of the input XML file nodes while
>modifying order or adding new attributes.
>In other words, how can one write an XSL stylesheet that outputs the
>exact same XML as the input file? Part of the problem is getting the node
>name (xsl:nodeName is not within the current draft)
in XT, you can use name(pattern) to access a node name. So if, for
example, you need to know the immediate ancestor name of any "field"
nodes within "page", this template:
My parent name is <xsl:value-of expr="name(..)"/>
will let you know.
>and iterate through
>it's attributes list.
I did not find out the equivelent of "@*" (which means all attributes in
MS-XSL ;-) but there's a copy that does preserve the source node. This
stylesheet will give the exact same tree as the input (useful as a
default template within a stylesheet that output XML):
<xsl:template match="/ | *">
Hope this helps users of XT, many thanks to James Clark! Feel free to
correct me if my description is incorrect or let us know of any further
features not part of the current draft.
Sitepak, Bringing Internet Business into Focus
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list