SunQuest
           XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old October 29th, 2003, 05:16 AM
hiccup hiccup is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 4 hiccup User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<xsl:attribute name="local-name()"> name only accepts literal text ?

I want to create a meta tag from this XML

<copyright>
<copyright>Kingston University, Faculty of Technology</copyright>
<author>Steve Knapp</author>
<revision>0.0.10.29</revision>
<change>Added copyright functionality</change>
</copyright>

to look like

<meta copyright="Kingston University, Faculty of Technology" author="Steve Knapp" revision="0.0.10.29" change="Added copyright functionality">

using this template

<xsl:template match="copyright">
<meta>
<xsl:for-each select="*">
<xsl:attribute name="local-name()">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
</meta>
</xsl:template>

But the <xsl:attribute name="local-name()"> , name only likes literal text. How can I get it to use my element name ?

TIA

Reply With Quote
  #2  
Old November 5th, 2003, 02:03 PM
teedee teedee is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 42 teedee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Put it in a variable and use {placeholders} to assign a value to the name attribute of the xsl:attribute

Code:
<xsl:template match="copyright"> 
<meta> 
<xsl:for-each select="*"> 
<xsl:variable name="LocalName" select="local-name()"/>
<xsl:attribute name="{$LocalName}"> 
<xsl:value-of select="."/> 
</xsl:attribute> 
</xsl:for-each> 
</meta> 
</xsl:template> 

Reply With Quote
  #3  
Old November 6th, 2003, 04:03 AM
hiccup hiccup is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 4 hiccup User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Muchos gracias

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > <xsl:attribute name="local-name()"> name only accepts literal text ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway