Re: [xsl] XSLT problem

Subject: Re: [xsl] XSLT problem
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 18 Aug 2008 16:53:27 +0200
Houman Khorasani wrote:

1) So I wish to copy all the rest elements between <UnitArtInfo> and
</UnitArtInfo> that could be there, inclusive this functionality that
you have  already successfully implemented (Button). I tried to change
your code to <xsl:apply-templates select="@* | node()"/>  but still
didn't succeed.

It is not clear where exactly you want to insert the new Button element but maybe changing the template to


<xsl:template match="a:UnitArtInfo[a:Type = document('')/xsl:stylesheet/a:UnitInfos/a:Unit/a:Type]">
<xsl:copy>
<xsl:apply-templates select="@* | *[not(self::a:fScale)]"/>
<xsl:element name="Button">
<xsl:value-of select="$unitInfo[a:Type = current()/a:Type]/a:Button"/>
</xsl:element>
<xsl:apply-templates select="a:fScale"/>
</xsl:copy>
</xsl:template>


will suffice. That copies all child elements besides he fScale element, then inserts the Button element, then copies the fSscale element.



2) All other Elements that do not match the list (e.g. Lion) should only
be copied over in the output like Zeppelin, but without a <Button>
Element.

To achieve 2) remove the line


<xsl:template match="a:UnitArtInfo[not(a:Type = document('')/xsl:stylesheet/a:UnitInfos/a:Unit/a:Type)]"/>

from the stylesheet I posted.


--


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

Current Thread