|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: copy from one xml to another
Hello Erik,
you need three things: 1. Accessing the second file via document(). 2. Accessing the correct Testcase via position(). 3. A recursive template for accessing the last substring of the name of the Action. <xsl:variable name="testcases" select="document('the-other-file')/Workflow/Testcase"/> <xsl:template match="testcase">
<xsl:copy>
<xsl:copy-of select="@time"/>
<xsl:attribute name="@name">
<xsl:variable name="pos" select="position()"/>
<xsl:call-template name="substring-after-last">
<xsl:with-param name="string" select="$testcases[$pos]/Action"/>
</xsl:call-template>
</xsl:attribute>
</xsl:copy>
</xsl:template><xsl:template name="substring-after-last"> <xsl:param name="string" select="''"/> <xsl:param name="delimiter" select="."/> <xsl:choose> <xsl:when test="contains($string, $delimiter)"> <xsl:call-template name="substring-after-last"> <xsl:with-param name="string" select="substring-after($string, $delimiter)"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> </xsl:template> Regards, Joerg Erik Stunkat wrote: Hello, XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








