473,626 Members | 3,947 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

eliminate hard-coded file names in xsl

I have an xsl stylesheet that merges data from two files based upon a
common date/time field. Right now, one of the file names is
hard-coded in the xsl file. Is there any way to make this parameter
driven so I can genericize it to process different file names in
different directories?

Here is my current run syntax:

java com.icl.saxon.S tyleSheet -o
C:\bin\merged_l rv_gps_and_tran s_tab_delim.xml C:\bin\lrv_tran s.xml
C:\bin\merge_lr v_gps_and_trans _to_tab_delim.x sl

And here is the xsl:

merge_lrv_gps_a nd_trans_to_tab _delim.xsl
----------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="delim" select="'&#x9;' "/> <!-- tab -->
<xsl:variable name="nl" select="'&#xA;' "/> <!-- newline -->
<xsl:variable name="head">
<xsl:for-each select="/root/header/*">
<xsl:value-of select="concat( ., $delim)"/>
</xsl:for-each>
</xsl:variable>

<xsl:template match="/root/record">
<xsl:variable name="gps"
select="documen t('lrv_gps.xml' )/root/record[date_time =
current()/date_time]"/>
<xsl:value-of select="$head"/>
<xsl:value-of select="concat( $gps/longitude, $delim,
$gps/latitude, $delim)"/>
<xsl:for-each select="*">
<xsl:value-of select="concat( ., $delim)"/>
</xsl:for-each>
</xsl:template>

<!--this empty template is to stop the header values from printing at
top of page-->
<xsl:template match="header">
</xsl:template>

</xsl:stylesheet>
TIA
Jul 20 '05 #1
1 1605

"Luke Airig" <lu********@hot mail.com> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
I have an xsl stylesheet that merges data from two files based upon a
common date/time field. Right now, one of the file names is
hard-coded in the xsl file. Is there any way to make this parameter
driven so I can genericize it to process different file names in
different directories?


Yes, pass the filename as a parameter to the transformation and in your xslt
code use a global xsl:param with the same name as that of the externally
passed parameter.

Here's an excerpt from the Saxon 6.5.3 documentation (\doc\using-xsl.html):

"A param takes the form name=value, name being the name of the parameter,
and value the value of the parameter. These parameters are accessible within
the stylesheet as normal variables, using the $name syntax, provided they
are declared using a top-level xsl:param element. If there is no such
declaration, the supplied parameter value is silently ignored.
Under Windows it is possible to supply a value containing spaces by
enclosing it in double quotes, for example name="John Smith". This is a
feature of the operating system shell, not something Saxon does, so it may
not work the same way under every operating system."

Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html


Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4266
by: Josh Lee | last post by:
Being the unpaid bum that i am, i am creating a stylesheet for my livejournal. The heading of my page consists of a table cell spanning the entire width of my page, with two lines of text inside. They are separated by a <br>, but i would like to combine them into a single line of text. Is it possible, using only css (because that's all i've got), to eliminate a br and turn it into a single line? I tried display:none but it didn't...
2
2733
by: John Bowling | last post by:
Everywhere I have used <h#> ... </h#>, with or without a class=.. I get an effective double line break, with or without CSS. What I want to do is to switch text colors, size, and positioning (left, center, right) and keep the text on the same line (unless I put in a <br> intentionally). Sometimes I want to do something like this: Left text centered text right text.
11
1793
by: Gianni Mariani | last post by:
I have a couple of template methods that take any integer type however, the first "if" statement becomes a constant expression when T is an unsigned type. #include <limits> template <typename T> static T bin_to_gray( const T & value ) {
3
3138
by: Tony Young | last post by:
Hi, I have a multimap container. I want to eliminate all "duplicate" elements. By duplicate I mean something like (3, 4), (4, 3) and (4, 3), in which I want to eliminate any two of these three. The most straightforward way I can think of is to first swap every member such that every member has its key smaller than its value. Then loop thru the multipmap and erase duplicates (please see the loop below). Is there a more automatic way...
7
2316
by: Eric J.Hu | last post by:
Hi, Such as I have following bitmap structure and assigned value: struct bm { char high2bits:2; char mid4bits:4; char low2bits:2; }; bm.high2bits = 3;
11
11346
by: Michael Mayo | last post by:
I have a simple html page that contains an image in a single table cell, surrounded by a border: <http://www.softrains.com/lc/test.html>. I would like to eliminate the space between the table border and the table contents. I have tried setting margin: 0 in CSS everywhere, as well as cellmargin/cellpadding in HTML. What is the best way to eliminate the extra space between a table border and its contents? Thanks,
16
1966
by: msundaram.visvanathan | last post by:
Hi, i tried to write this small code in C which would: Input :a b c d Output:abcd code: #include<stdio.h>
56
3763
by: Ed Jay | last post by:
I note in an Eric Meyers book that he expresses one goal of using CSS is to eliminate all <brtags. Why? -- Ed Jay (remove 'M' to respond by email)
0
1134
by: Karlcan | last post by:
As a former smoker, I know first hand how hard it is to quit smoking. My many efforts to stop failed until I was truly ready to quit. Whatever works is fair game in my book. The new e-cigarette, available mainly in China and Europe right now, may be just the answer for many who smoke not only for the nicotine but also the tactile pleasures of smoking itself. This new e-cigarette, made with a stainless steel shell, lithium ion battery,...
18
1579
by: chilipepas | last post by:
Hello. I receive from a database a variable number of results. In my page, I can show a maximum of 36 results. I want to "neatly" eliminate the exceeding results. For example: say, we have 40 results.
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.