This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: How to get xml tag in the xsl rule
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: How to get xml tag in the xsl rule
- From: Manish Shah <MShah at etimecapital dot com>
- Date: Tue, 29 Feb 2000 13:21:01 -0800
- Cc: "'davidc at nag dot co dot uk'" <davidc at nag dot co dot uk>
- Reply-To: xsl-list at mulberrytech dot com
Hi david,
You are right, the rule will apply to only top levels. But my xml document
has a root and rest of the elements. There are no other parents.
The name(.) prints out verbatim "name(.)" and not the tag name. Here is what
I am trying to do. The xml is as follows:
<LOGIN_NAME>ABCD</LOGIN_NAME>
<xsl:template match="*">
<input type="text" name="NEED SOME WAY TO GET TAG HERE" value="{.}"
maxlength="50" size="50"></input>
</xsl:template>
this should give me
<input type="text" name="LOGIN_NAME" value="ABCD"
maxlength="50" size="50"></input>
-----Original Message-----
From: David Carlisle [mailto:davidc@nag.co.uk]
Sent: Tuesday, February 29, 2000 11:12 AM
To: xsl-list@mulberrytech.com
Subject: Re: How to get xml tag in the xsl rule
<xsl:template match="/ | *">
<input type="text" name="NEED SOME WAY TO GET TAG HERE" value="{.}"
maxlength="50" size="50"></input>
</xsl:template>
Are you _sure_ you want that rule to match / ?
since "/ | *" matches / this template will be called and then there is
nothing to put in the name="" because the root does not have a name
and nothing else will happen as the template does not call
apply-templates and so processing will stop and no elements will be
matched.
So I would guess that you want
<xsl:template match="*">
<input type="text" name="name(.)" value="{.}"
maxlength="50" size="50"></input>
</xsl:template>
but that again will not go down the tree it will only do top level
elements
David
PS you do not want the tag you want the element name (these are
different things)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list