Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL: How do I create dynamic Node Names?

Status
Not open for further replies.

requested89

IS-IT--Management
Sep 6, 2005
44
GB
I want to use dynamic node names so that I don't have to rewrite a lot of code. Many of my nodes use the same XSL and the only thing that is different is the node name.

I can't find any examples unfortunatley. Can anyone show me an example?

Thanks in advance,

Chris
 
Something like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  <xsl:template match="/">
    <xsl:variable name="nodeNames">
      <name>one</name>
      <name>two</name>
      <name>three</name>
    </xsl:variable>
    <xsl:for-each select="msxsl:node-set($nodeNames)//*">
      <xsl:element name="{.}">content</xsl:element>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top