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

RE: doctype

Subject: RE: doctype
From: "John Power" <john.power@xxxxxxxxxxxx>
Date: Fri, 24 Nov 2000 18:21:27 -0000
john power
Gerhard,
	The top-level element is the direct child of the root.
Also, there can only be one top-level element in any XML file.
So, in order to get the top-level element name, match the root element and
get the name of its child with the 'name()' function.

I'm a bit unsure which variable you want to have global scope. If it's
"DocType", then you can get the top-level element name like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!--Declare "DocType" as a top-level variable -->
<xsl:variable name="DocType">
	<xsl:value-of select="name(/*)"/>
</xsl:variable>

This can now be used wherever you want to create "RecordLayout". But you
need to create "RecordLayout"
inside a template. For example, if you want to access "RecordLayouts" in the
root template:

<!-- apply the 'root' template and declare the "RecordLayouts" in the
template.-->
<xsl:template match="/">
<xsl:variable name="RecordLayouts"
select="document(concat($DocType,'else.xml'))"/>
		...other processing...
</xsl:template>
</xsl:stylesheet>

Alternatively, if you want BOTH variables to be top-level(so that the
external XML document will be available to every template), I'm afraid I
don't know how to do that.
But I hope this helps,
John Power


 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.