|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Newbie: How to write a stylesheet that preserves the inp
(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:
<xsl:template match="page//field">
My parent name is <xsl:value-of expr="name(..)"/>
</xsl:template>
</xsl:stylesheet>
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:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/ | *">
<xsl:copy><xsl:process-children/></xsl:copy>
</xsl:template>
</xsl:stylesheet>
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.
Francois Belanger
Sitepak, Bringing Internet Business into Focus
http://www.sitepak.com
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
|

Cart








