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

Accessing a node name from within <xsl:attribute>

Subject: Accessing a node name from within <xsl:attribute>
From: Kate Olding <kolding@xxxxxxxxxxxxxxx>
Date: Thu, 6 Jul 2000 14:02:01 +0100
xsl access node name
Hello

I am new to XSL. I am looking into transforming XML into HTML using XSL for 
displaying in Internet Explorer 5. To create the meta tags I want to copy 
the element name used to be the value of the name attribute and then use 
the element content as the value of the content attribute. My source is:

<metainfo>
<description>A UK based Business & IT services company
specialising in information management consulting
to businesses worldwide.</description>
<keywords>keyword1, keyword 2 etc</keywords>
</metainfo>

and I would like this to be

<META name="description" content="A UK based Business & IT services company
specialising in information management consulting to businesses worldwide.>

in the output (and the same for the keywords) but I don't want to process 
the elements specifically so that authors can then add their own meta 
information, for instance if they wanted to add the author they could just 
put:

<author>J. Smith</author>

and this information would be processed by the stylesheet without a 
template for metainfo/author being added.

So far I have got:

<xsl:template match="metainfo">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="metainfo/*">
  <META>
  <xsl:attribute name=[node-name here]>
  <xsl:value-of/>
  </xsl:attribute>
  </META>
</xsl:template>

but I don't know how to access the node name from within an xsl attribute. 
Can anyone help with this question please and/or point me in the direction 
of some good beginners guides to XSL?

Thanks for your help.

Kate Olding
Consultant
OpenMIND Consulting
http://www.open-mind.co.uk
Office: +44 01869 238080
Mobile: +44 07730 064358


 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.