Subject: RE: Getting name of and element
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Fri, 16 Nov 2001 11:27:48 -0000
|
Pickaxe,
<?xml version="1.0" ?>
<test att1="" att2="" att3="">
</test>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "html" encoding="Windows-1252" />
<xsl:template match="/*">
<html>
<head></head>
<body>My top level element is <xsl:value-of
select="name()" /><br/>
It's attributes are <xsl:for-each
select="@*">
<xsl:value-of select="name()" />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Ragulf Pickaxe
> Sent: 16 November 2001 10:54
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Getting name of and element
>
>
> Well, I now have a different problem, being that I don't get
> the expected
> attribute at all (see mails about getting attribute from
> root-node). Is
> there a way for me to get the _name_ of the root-element?
>
> That is, I need the name of the node, not what it contains:
> XML:
> ..
> <TopmostNodeWithANameThatIDoNotKnow>Has not the attribute
> that I am trying
> to extract</TopmostNodeWithANameThatIDoNotKnow>
> ..
>
> I want the name so that I can see where things goes wrong - I
> expect that we
> try to put the attribute into a differently named node (which
> does not give
> an error, unfortunately).
>
> If I can just put the name into a variable, I can then print
> out the name of
> the value. Incidently, how do you get the names of the
> attributes that a
> given node has, if possible?
>
> Hope you can help me
> (With help, I mean "Yes, this can be done and you do
> this...", not "No way
> of doing what you want" ;-)
>
> Sincerly
> Ragulf Pickaxe :)
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com/intl.asp
>
>
> XSL-List info and
> archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|