This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: doctype
- To: xsl-list at mulberrytech dot com
- Subject: Re: doctype
- From: Oliver Becker <obecker at informatik dot hu-berlin dot de>
- Date: Fri, 24 Nov 2000 19:53:11 +0100 (MET)
- Cc: STENZEL at de dot ibm dot com
- Reply-To: xsl-list at mulberrytech dot com
> Hi, I am trying to find out the doctype , i.e top level element name, in
> order to load an additional file, whose name is based on the doctype.
[...]
> I think it should close to the following, but I am still missing the ???
> part?
> <xsl:variable name="DocType">
> <xsl:value-of select="???"/>
> </xsl:variable>
> <xsl:variable name="RecordLayouts" select="document(concat($DocType,
> 'else.xml'))"/>
For the name of the top level element (in XML terms the "document element") use
<xsl:value-of select="name(/*)" />
BTW, your code can be written much shorter:
Step 1:
replace
<xsl:variable ..>
<xsl:value-of select=
<(xsl:variable>
with
<xsl:variable name=... select="the expression from value-of" />
Step 2:
Use the expression where you need it (if it's only once):
<xsl:variable name="RecordLayouts"
select="document(concat(name(/*),'else.xml'))"/>
Cheers,
Oliver
/-------------------------------------------------------------------\
| ob|do Dipl.Inf. Oliver Becker |
| --+-- E-Mail: obecker@informatik.hu-berlin.de |
| op|qo WWW: http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list