Copying Values From One Attribute to Another
Novell Cool Solutions: Tip
Digg This -
Slashdot This
Posted: 25 Jun 2002 |
Here's how to take all the values in Group Membership and copy them to Security Equals. The following stylesheet accomplishes this task using the <xsl:copy-of> (not <xsl:copy>) to insert a result tree fragment into the result tree.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="association add-association remove-association value component password check-password"/>
<xsl:output indent="yes" method="xml"/>
<!-- identity transform for everything we don't want to mess with -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="add-attr[@attr-name='Group Membership']">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<add-attr attr-name="Security Equals">
<xsl:copy-of select="./value"/>
</add-attr>
</xsl:template>
</xsl:stylesheet>

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com