Hi,
> I have the following XML:
> ?
> ?
> <Specification_expression id="specification_expression-1">
> ??????<id>teste</id>
> ????? <description>teste</description>
> ????? <operation>or_operator</operation>
> ????? <operand>
> ?????????? <sos ref="sos-1"/>
> ????? </operand>
> ?</Specification_expression>
> ??
> ?<sos id="sos-1">
> ??<Specification ref="specification-7"/>
> ?</sos>
I assume these two XML fragments exist in the same document. If so,
<xsl:template match="sos[@ref]">
<xsl:copy>
<xsl:apply-templates select="//sos[@id = current()/@ref]/node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="sos[@id]"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
Will get you there. If you have a DTD that defines the "id" attribute as an ID, then
<xsl:apply-templates select="id(@ref)/node()"/>
Will also get you there-again, there are other ways, too.
Cheers,
Jarno - This Morn' Omina: One Eyed Man
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- ID refs
- Ricardo Saraiva - Mon, 19 Jan 2004 06:53:25 -0500 (EST)
- <Possible follow-ups>
- Jarno . Elovirta - Mon, 19 Jan 2004 07:36:27 -0500 (EST) <=
|
|