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

Re: Using a node-set as a variable

Subject: Re: Using a node-set as a variable
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Jan 2019 23:42:12 -0000
Re:  Using a node-set as a variable
"node-set" is xslt 1 terminology not used in xslt 2 or 3 but anyway I
think you just want

<xsl:copy-of
select="document('yourfile.xml')/settings/parts-head[@language=$lang]"/>

assuming $lang has been set to "en" or whatever. If you have thousands
of languages you might want to use a key to save a linear search but..


David

On Thu, 17 Jan 2019 at 23:12, Rick Quatro rick@xxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
>
>
> I am using an XSLT 2 processor and I have a template like this:
>
>
>
>     <xsl:template name="parts-head">
>
>         <parts-head>
>
>             <head-row>
>
>                 <head-cell>Index No.</head-cell>
>
>                 <head-cell>Qty</head-cell>
>
>                 <head-cell>U/M</head-cell>
>
>                 <head-cell>Part No.</head-cell>
>
>                 <head-cell>Component Description</head-cell>
>
>                 <head-cell>Shop Order Section</head-cell>
>
>             </head-row>
>
>         </parts-head>
>
>     </xsl:template>
>
>
>
> I need to localize each of the <head-cell> elements. I would like to find a
way to have the localized elements, or the entire <parts-head> element in an
external XML file, so I can do the localization there. I do have a language
parameter that I can use to tell which element I need. But I am not sure what
the best practice is here.
>
>
>
> I could have my external XML file like this:
>
>
>
>     <settings>
>
>         <parts-head language="en">
>
>             <head-row>
>
>                 <head-cell>Index No.</head-cell>
>
>                 <head-cell>Qty</head-cell>
>
>                 <head-cell>U/M</head-cell>
>
>                 <head-cell>Part No.</head-cell>
>
>                 <head-cell>Component Description</head-cell>
>
>                 <head-cell>Shop Order Section</head-cell>
>
>             </head-row>
>
>         </parts-head>
>
>         <parts-head language="es">
>
>             <head-row>
>
>                 <head-cell>Span Index No.</head-cell>
>
>                 <head-cell>Span Qty</head-cell>
>
>                 <head-cell>Span U/M</head-cell>
>
>                 <head-cell>Span Part No.</head-cell>
>
>                 <head-cell>Span Component Description</head-cell>
>
>                 <head-cell>Span Shop Order Section</head-cell>
>
>             </head-row>
>
>         </parts-head>
>
>     <settings>
>
>
>
> and read this into a global variable. But then how do I insert the desired
<parts-head> element into my output? Thank you for any suggestions.
>
>
>
> Rick
>
>
>
> Rick Quatro
>
> Carmen Publishing Inc.
>
> rick@xxxxxxxxxxxxxxx
>
> 585-729-6746
>
> www.frameexpert.com/store/
>
>
>
> Save on energy at quatro.mystream.com
>
>
>
>
>
> XSL-List info and archive
> EasyUnsubscribe (by email)

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.