This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Accessing a node name from within <xsl:attribute>


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]