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

Re: Easy one! variables & documents)

Subject: Re: Easy one! variables & documents)
From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx>
Date: Wed, 30 Apr 2003 15:20:21 -0700
document variables
I GOT IT!!!!!!

     <xsl:for-each select="@*">
     <xsl:variable name="name" select="name()"/>
        <tr>
        <td><!-- lookup text for display in xml template -->
        <xsl:value-of select="$xmTmplt[@name=$name]/@text"/></td>
     <td>
        ....

Is this the way to do it?  Did I need to declare the variable name, or could
I have accessed name directly from the select?

Thanks for the help.
Karl


----- Original Message -----
From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, April 30, 2003 3:07 PM
Subject: Re:  Easy one! variables & documents)


> Okay, I got that.
> Now I am having trouble... I need to select from this external doc the
value
> of one of the nodes.  So, I'm within the context of another template, and
> from this template there is an attribute @Name, who's value will match one
> of the values from the external doc.  I'm trying to get the @Text value
from
> the external doc where the @Name matches in both.  So:
>
>      <xsl:for-each select="@*">
>         <tr>
>         <td><!-- lookup text for display in xml template -->
>         <xsl:value-of select="$xmTmplt/[@name=name()]/text"/>
>         </td>
>
> ...  doesn't work : (
>
> Here is my variable decleration, which I've tested and it works:
>
> <xsl:variable name='xmTmplt'
> select="document('usr_member.xml')/FLDS/FLD"/>
>
> Karl
>
> ----- Original Message -----
> From: "Rick Taylor" <taylor@xxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, April 30, 2003 2:38 PM
> Subject: Re:  Easy one! variables & documents)
>
>
> > Karl,
> >
> > I didn't notice the copy-of that you have in the variable.  Try the
> > following to yield a nodeset that you can apply a for-each to.
> >
> > <xsl:variable name="xmTmplt"select="document('usr_member.xml')//FLDS"/>
> >
> > -rick
> >
> >
> > At 02:07 PM 4/30/03 -0700, you wrote:
> > >I am reading an external xml document into a variable at the very top o
f
> my
> > >stylesheet (is this legal?)... later I loop through this document.. but
I
> > >don't know how to access the variable in a select statement (it doesn't
> like
> > >the $ in the select statement).  Here's the code:
> > >
> > ><xsl:variable name="xmTmplt"><xsl:copy-of
> > >select="document('usr_member.xml')//FLDS"/></xsl:variable>
> > >
> > >
> > >
> > >
> > ><xsl:template name="TEMP">
> > ><hr/>
> > >  <xsl:for-each select="xmTmplt/FLD">
> > >     <xsl:text>testing..</xsl:text>
> > >  </xsl:for-each>
> > ><hr/>
> > ></xsl:template>
> > >
> > >Should yield:
> > >testing..testing..testing..testing..testing..testing..
> > >
> > >Thanks,
> > >Karl
> > >
> > >
> > >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> > Rick Taylor
> > XML Developer
> > PPDM Association
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >
>
>
>  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

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.