473,500 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass file name parameter to xsl stylesheet

I am using the Saxon 6.5.3 engine and I have an xsl stylesheet that
merges two files on a date_time field and writes out a tab-delimited
flat file. My working version has a hard-coded file name in the xsl
file. I dug through the
Saxon documenation to find a way to feed a file name param to
eliminate the hard-coded file name in the xsl. This version executes
but does not appear to do the merge processing and drops the longitude
and latitude values. Can
anyone give me some insight as to what I am doing wrong with this?
My command line run syntax is commented at the bottom.

merge_lrv_gps_and_trans_to_tab_delim.xsl
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 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="/">
<xsl:apply-templates select="root/record"/>
</xsl:template>

<xsl:template match="record">
<!--note: if lrv_gps.xml is in a different directory, you will
need to use the relative path or URL-->
<!-- select="document('lrv_gps.xml')/root/record[date_time =
current()/date_time]"/> -->
<xsl:param name="lrv_gps_file"/>
<xsl:variable name="gps"
select="document($lrv_gps_file)/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:value-of select="$nl"/>
</xsl:template>

</xsl:stylesheet>

<!-- java com.icl.saxon.StyleSheet -o
C:\bin\merged_lrv_gps_and_trans_tab_delim.xml C:\bin\lrv_trans.xml
C:\bin\merge_lrv_gps_and_trans_to_tab_delim.xsl
{lrv_gps_file=lrv_gps.xml}
-->
Jul 20 '05 #1
1 3225
Luke Airig wrote:
Saxon documenation to find a way to feed a file name param to
eliminate the hard-coded file name in the xsl. This version executes
but does not appear to do the merge processing and drops the longitude
and latitude values.
You're very close. The only problem is that the param is not declared
in the right place. If you move it just after the <xsl:stylesheet> tag,
I think it should work just fine:
merge_lrv_gps_and_trans_to_tab_delim.xsl
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/> <xsl:param name="lrv_gps_file"/> <xsl:variable name="delim" select="'&#x9;'"/> <!-- tab -->


The parameter is being passed to the stylesheet and not to the record
template as you had written it.

Ed

Jul 20 '05 #2

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

Similar topics

2
4776
by: Geathaa | last post by:
Hi everyone, I want to transform a xml document containing the description of a menu tree to HTML. The MenuTree XML contains the target URL for each tree node. Some URL's contain parameters...
4
1950
by: Tristan Miller | last post by:
Greetings. I would like to produce a static multilingual website in XHTML. Is it possible to specify each web page in its own XML file, but have all of the translations encapsulated in that one...
1
1591
by: Luke Airig | last post by:
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...
4
14216
by: Corey | last post by:
All, I am relatively new to XML and I have what may sound like a dumb question. I want to pass a query string variable to my xml document and filter the output based on that variable. For...
7
21580
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
5
3736
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
2
2014
by: arthuryeung198 | last post by:
Hi all, I got a JSP using JSTL to transform XML to HTML, and I want to pass a variable "statusFilter" into the XSL. e.g. <x:parse xml="${xml}" var="doc" /> <x:transform xml="${doc}"...
1
5084
by: Tarlanim | last post by:
Hi, i'm looking for a way to pass parameter from a HTML-File to a XML-File. In HTML-File i have a reference to XML-File and i want to use the parametre from the HTML-File in XML-File (Parameter...
3
3147
by: shapper | last post by:
Hello, Could someone tell me how to convert a XML file into another XML file using a XSL file with a parameter? I created the code to do it, and it seems ok, but it is not working. Could...
0
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7018
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...
0
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4923
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...
0
4611
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...
0
3110
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...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
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...

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.