[Home] [By Thread] [By Date] [Recent Entries]

Subject: RE: Building a new tree
From: Bovone Stefano <Stefano.Bovone@xxxxxxxx>
Date: Wed, 14 Apr 1999 08:22:13 +0200
Title: RE: Building a new tree

Thanks Nantapon,
but I have in my original document xsl:id attribute="id".
XSL:P of Mr. K. Visco supports id(@ref).

But the problem should be different, and I don't undertand what it is.

Bye.

    ----------
    From:   Nantapon Chaimunkong[SMTP:b38npc@xxxxxxxx]
    Reply To:       xsl-list@xxxxxxxxxxxxxxxx
    Sent:   martedì 13 aprile 1999 19.21
    To:     'XSL-List@xxxxxxxxxxxxxxxx'
    Subject:        Re: Building a new tree

    You must identify id element using xsl:id before using id().

    I try the following stylesheet. It doesn't work on XT, though. XT doesn't
    support id.

    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" indent-result-"yes">
    <xsl:id attribute="id"/>

    <xsl:template match="common"/>

    <xsl:template match="/">
      <xsl:apply-templates select=".//letter"/>
    </xsl:template>

    <xsl:template match="letter//*|common//*">
      <xsl:copy><xsl:apply-templates/></xsl:copy>
    </xsl:template>

    <xsl:template match="letter//insert_common|common//insert_common">
     <xsl:apply-templates select="id(@ref)/*"/>
    </xsl:template>

    </xsl:stylesheet>


    On Tue, 13 Apr 1999, Bovone Stefano wrote:

    > I have, for example, the following XML document:
    >
    > <?xml version="1.0"?>
    >
    > <document>
    >       <common id="D1">
    >         <p>First common part A</p>
    >         <p>First common part b</p>
    >             </common>
    >
    >       <common id="D2">
    >         <title>SECOND COMMON PART</title>
    >       </common>
    >
    >       <letter>
    >         <doc>
    >         <title> THE DOCUMENT </TITLE>
    >         <p> generic text</p>
    >         <insert_common ref="D1"/>
    >         <p> generic text</p>
    >         <insert_common ref="D2"/>
    >               </doc>
    >              </letter>
    > </document>
    >
    > and I want using a XSL document to have:
    >
    > <?xml version="1.0"?>
    >   <doc>
    >         <title> THE DOCUMENT </TITLE>
    >         <p> generic text</p>
    >         <p>First common part A</p>
    >         <p>First common part b</p>
    >         <p> generic text</p>
    >         <title>SECOND COMMON PART</title>
    >    </doc>
    >             
    > I thought to use:
    >
    > <?xml version="1.0"?>
    > <xsl:stylesheet xmlns:xsl="http:/www.w3.org/TR/WD-xsl">
    >
    > <xsl:template match="/">
    >  <xsl:template select=".//letter"/>
    > </xsl:template>
    >
    > <xsl:template match="letter">
    >   <xsl:apply-templates/>
    > </xsl:template>
    >
    > <xsl:template match="letter/* | letter//*">
    >  <xsl:copy>
    >   <xsl:apply-templates select="text() | @* | * | ./* | insert_common"/>
    >  </xsl:copy>
    > </xsl:template>
    >
    > <xsl:template match="insert_common">
    >   <xsl:apply-templates select="id(@ref)/tag"/>
    > </xsl:template>
    >
    > <xsl:template match="tag/*">
    >  <xsl:copy>
    >   <xsl:apply-templates select="text() | * | ./*"/>
    >  </xsl:copy>
    > </xsl:template>
    >
    > </xsl:stylesheet>    
    >
    >
    > but it doesn't work.
    >
    > Have anybody any idea ?
    >
    > Thanks. Bye.
    >
    >


     XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member