|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: ID refs
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
|
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








