|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
<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 |
|
#2
|
|||
|
|||
|
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>
|
|
#3
|
|||
|
|||
|
Muchos gracias
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > <xsl:attribute name="local-name()"> name only accepts literal text ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|