xsl-list
[Top] [All Lists]

Re: [xsl] InnerElement attribute needs to be set for parent

2008-05-10 04:47:16
Arulraj wrote:

How to copy the attributes from the <property> name and value to <propertyList> 
with name as the attribute ?

Here is a sample stylesheet:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0">

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="propertyList">
    <xsl:copy>
      <xsl:apply-templates select="property"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="property">
    <xsl:attribute name="{(_at_)name}">
      <xsl:value-of select="@value"/>
    </xsl:attribute>
  </xsl:template>

</xsl:stylesheet>

--

        Martin Honnen
        http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--