Re: [xsl] dynamic file variable

Subject: Re: [xsl] dynamic file variable
From: "Carmelo Montanez" <carmelo@xxxxxxxx>
Date: Mon, 5 Nov 2001 17:06:01 -0500
you welcome.
Carmelo
----- Original Message ----- 
From: "yan bai" <bytj@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, November 05, 2001 4:54 PM
Subject: Re: [xsl] dynamic file variable


> Carmelo,
> Thanks.  I fixed it.  Though it is irrelevant to
> whether it is "linkname" or "refname", your answer did
> convince me that the syntax is correct.  I moved the
> code snippet to a proper place and it works.
> 
> Thanks again.
> 
> Yan
> --- Carmelo Montanez <carmelo@xxxxxxxx> wrote:
> > Hi:
> > 
> >     Try and define your variable as:
> >     <xsl:variable name="refname">
> >       <xsl:value-of select="@linkname"/>
> >     </xsl:variable>
> > 
> > I think you want the "linkname" attribute NOT THE
> > "refname" attribute
> > (which according to your description does not exists
> > in your XML source).
> > 
> > (As a side note, naming variables and attributes
> > with the same name can lead
> > to confusion)
> > 
> > Hope it helps,
> > Carmelo Montanez
> > 
> > ----- Original Message -----
> > From: "yan bai" <bytj@xxxxxxxxx>
> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> > Sent: Monday, November 05, 2001 3:51 PM
> > Subject: [xsl] dynamic file variable
> > 
> > 
> > > I have a main.xml file, in which there is a lot of
> > > <ref> elements.
> > > There is an attribute "linkname" in each <ref>
> > like:
> > > <ref linkname="test_2.xml"/>
> > >
> > > In test_2.xml, there is only one root element and
> > a
> > > child element like:
> > > <test>
> > >       <sub_test link="html_test.html"/>
> > > </test>
> > >
> > > I use the following code to get the referenced
> > data:
> > > <xsl:template match="ref">
> > > <xsl:variable name="refname">
> > >        <xsl:value-of select="@refname"/>
> > > </xsl:variable>
> > > <br/>
> > > Here is the referenced file data:
> > > <xsl:value-of
> > > select="document($refname)/test/sub_test/@link"
> > > />
> > > </xsl:template>
> > >
> > > It returns null.  However, if the variable
> > "$refname"
> > > is replaced by the actual file name "test_2.xml",
> > then
> > > the data can be properly grabbed.
> > >
> > > Any one can tell me what is wrong?
> > >
> > > Thanks so much
> > >
> > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Find a job, post your resume.
> > > http://careers.yahoo.com
> > >
> > >  XSL-List info and archive: 
> > http://www.mulberrytech.com/xsl/xsl-list
> > >
> > >
> > 
> > 
> >  XSL-List info and archive: 
> > http://www.mulberrytech.com/xsl/xsl-list
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Find a job, post your resume.
> http://careers.yahoo.com
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


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


Current Thread