[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi all,
Problem:
<xsl:key name="insert.template.elem" match="*" use="name()"/>
and applying it this way:
<xsl:template match="@* |node()" mode="copy.rng" >
<xsl:choose>
<xsl:when test="name()='element' ">
<xsl:element name="{name()}">
<xsl:variable name="elem.name" select="@name"/>
<xsl:attribute name="name"><xsl:value-of select="$elem.name"/>
</xsl:attribute>
<sm:map>
<sm:item table="kennungen">
<xsl:attribute name="field">
<xsl:for-each select="$insertTemplate"><xsl:value-of select="key('insert.template.elem',$elem.name)"/></xsl:for-each>
</xsl:attribute>
</sm:item>
</sm:map>
<xsl:apply-templates mode="copy.rng"/>
</xsl:element>
</xsl:when>
...
...
<xsl:when test="name()='attribute' ">
<xsl:element name="{name()}">
<xsl:variable name="attr.name" select="@name"/>
<xsl:attribute name="name"><xsl:value-of select="$attr.name"/>
</xsl:attribute>
<sm:map>
<sm:item table="kennungen">
<xsl:attribute name="field">
<xsl:for-each select="$insertTemplate"><xsl:value-of select="key('insert.template.attr',$attr.name)"/></xsl:for-each>
</xsl:attribute>
</sm:item>
</sm:map>
<xsl:apply-templates mode="copy.rng"/>
</xsl:element>
</xsl:when>
...
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
[xsl] name of attributes like name() function for elements?
Subject: [xsl] name of attributes like name() function for elements? From: Georges Schmitz <georges.schmitz@xxxxxxxxx> Date: Thu, 05 Dec 2002 13:45:23 +0100 |
Hi all,
Is it possible to get the name of an attribute in the same way, as with the name() function for elements?
Problem:
When merging to files - in my case RelaxNG with some proprietary extensions residing in a seperate file - I use a key function to retrieve the content of an element node of the extension file:
<xsl:key name="insert.template.elem" match="*" use="name()"/>
and applying it this way:
<xsl:template match="@* |node()" mode="copy.rng" >
<xsl:choose>
<xsl:when test="name()='element' ">
<xsl:element name="{name()}">
<xsl:variable name="elem.name" select="@name"/>
<xsl:attribute name="name"><xsl:value-of select="$elem.name"/>
</xsl:attribute>
<sm:map>
<sm:item table="kennungen">
<xsl:attribute name="field">
<xsl:for-each select="$insertTemplate"><xsl:value-of select="key('insert.template.elem',$elem.name)"/></xsl:for-each>
</xsl:attribute>
</sm:item>
</sm:map>
<xsl:apply-templates mode="copy.rng"/>
</xsl:element>
</xsl:when>
...
But there is also information stored in attributes I need to retrieve in a similar way. How can this be accomplished? I'm imagining something like the following:
<xsl:key name="insert.template.attr" match="@*" use="attr-name()"/> ^^^^ ^^^^ something like this! and then applying it again this way:
...
<xsl:when test="name()='attribute' ">
<xsl:element name="{name()}">
<xsl:variable name="attr.name" select="@name"/>
<xsl:attribute name="name"><xsl:value-of select="$attr.name"/>
</xsl:attribute>
<sm:map>
<sm:item table="kennungen">
<xsl:attribute name="field">
<xsl:for-each select="$insertTemplate"><xsl:value-of select="key('insert.template.attr',$attr.name)"/></xsl:for-each>
</xsl:attribute>
</sm:item>
</sm:map>
<xsl:apply-templates mode="copy.rng"/>
</xsl:element>
</xsl:when>
...
Thanks in advance, Georges
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Replacing <break> tag whe, Cams Ismael | Thread | Re: [xsl] name of attributes like n, Jeni Tennison |
Re: [xsl] sequential navigation pro, Jeni Tennison | Date | Re: [xsl] How to give out XML-Tags?, Joerg Heinicke |
Month |