xsl-list
[Top] [All Lists]

Re: [xsl] XSLT problem

2008-08-18 07:54:03
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/

--~------------------------------------------------------------------
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>
--~--