Hi again:
I'm trying to do something like this:
Given
<Menu>
<Menu_K>X00123</Menu_K>
<MenuData/>
<MenuTipo>TXT</MenuTipo>
<MenuTitulo>Ambitos</MenuTitulo>
<Menu>
<Menu_K>X00124</Menu_K>
<MenuData>X00125</MenuData>
<MenuTipo>REP</MenuTipo>
<MenuTitulo>(...)</MenuTitulo>
</Menu>
</Menu>
and another XML similar (actually it can be the same)
<Menu>
<Menu_K>X00125</Menu_K>
<MenuData/>
<MenuTipo>TXT</MenuTipo>
<MenuTitulo>Sub-Ambitos</MenuTitulo>
<Menu>
<Menu_K>X00126</Menu_K>
<MenuData/>
<MenuTipo>TXT</MenuTipo>
<MenuTitulo>Sub-Sub-Ambitos</MenuTitulo>
</Menu>
</Menu>
i want to apply a identity transform that simply replaces the REP
menus with the menu whose K is defined on MenuData, so in the example
i'll get
<Menu>
<Menu_K>X00123</Menu_K>
<MenuData/>
<MenuTipo>TXT</MenuTipo>
<MenuTitulo>Ambitos</MenuTitulo>
<Menu>
<Menu_K>X00125</Menu_K>
<MenuData/>
<MenuTipo>TXT</MenuTipo>
<MenuTitulo>Sub-Ambitos</MenuTitulo>
<Menu>
<Menu_K>X00126</Menu_K>
<MenuData/>
<MenuTipo>TXT</MenuTipo>
<MenuTitulo>Sub-Sub-Ambitos</MenuTitulo>
</Menu>
</Menu>
</Menu>
I've done this
<xsl:template match="Menu">
<xsl:choose>
<xsl:when test="MenuTipo='REP'">
<xsl:apply-templates
select="document('TreeMenu.xml')//Menu[Menu_K=current()/MenuData]/Menu"
/>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
wich is working OK, *unless* in the second XML i have also REP menus.
In that case the REP menus on the second tree are just ignored, nor
are copyed nor REPlaced.
What i was hoping to get is the replaced menus, everywere. That is why
i'm using apply-templates instead of copy-of, tath copys the entire
second tree but withou replacing the REP's.
What am i doing wrong in here?
Thanks.
--~------------------------------------------------------------------
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>
--~--