[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: doctype
Subject: RE: doctype From: "John Power" <john.power@xxxxxxxxxxxx> Date: Fri, 24 Nov 2000 18:21:27 -0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
doctype, STENZEL | Thread | Re: doctype, Dimitre Novatchev |
RE: XSL Compilation, Joerg Pietschmann | Date | XSL-FO: footnotes in tables, David Carlisle |
Month |
Keywords