[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: ID refs

Subject: RE: ID refs
From: Jarno.Elovirta@xxxxxxxxx
Date: Mon, 19 Jan 2004 14:36:21 +0200
xsl id
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) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.