Compliant with the XPipe XML Component Architecture (http://xpipe.sourceforge.net)
Documentation |
---|
SynopsisAdd child to an given element in xml document using XSLT. Parameters
DescriptionFind all elements of type ETNOfAttachPoints and adds a child element of type ETNForNew. |
Details Summary | |
---|---|
Version | 0.1 |
Author | Sean McGrath |
KeyWords | XSLT |
Tree Transformation | |
Element Structure Transformation | |
Parameters | ETNForNew : |
ETNOfAttachPoints : | |
Pre | |
---|---|
HREF | None |
Type | None |
Encoding | PLAIN |
ExtractFilename | None |
CLASSPATH | None |
Body | None |
Code | |
---|---|
Type | XSLT |
Encoding | PLAIN |
ExtractFilename | None |
CLASSPATH | None |
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="ETNForNew"/> <xsl:param name="ETNOfAttachPoints"/> <xsl:template match="/"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="*"> <xsl:choose> <xsl:when test="name()=$ETNForNew"> <xsl:copy> <xsl:element name="{$ETNOfAttachPoints}"> </xsl:element> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:transform> |
Post | |
---|---|
HREF | None |
Type | None |
Encoding | PLAIN |
ExtractFilename | None |
CLASSPATH | None |
Body | None |
Test : First Test | |||||||
---|---|---|---|---|---|---|---|
Parameters | ETNForNew : bar | ||||||
ETNOfAttachPoints : foo | |||||||
Input |
| ||||||
Output |
|
Resource : UnitTestFile1 | |
---|---|
Encoding | PLAIN |
ExtractFilename | None |
Body | <?xml version="1.0"?> <test><foo></foo></test> |
Resource : UnitTestFile2 | |
---|---|
Encoding | PLAIN |
ExtractFilename | None |
Body | <?xml version="1.0"?> <test><foo><bar/></foo></test> |