473,624 Members | 2,561 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_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="/">
<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="documen t('lrv_gps.xml' )/root/record[date_time =
current()/date_time]"/> -->
<xsl:param name="lrv_gps_f ile"/>
<xsl:variable name="gps"
select="documen t($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.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
{lrv_gps_file=l rv_gps.xml}
-->
Jul 20 '05 #1
1 3235
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_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:param name="lrv_gps_f ile"/> <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
4787
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 which are only known at runtime though. These "runtime parameters" are also set as global parameters in the XSLT stylesheet. What I want to do now is check the URL defined in the XML and replace any "runtime parameter" with the stylesheet parameter...
4
1972
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 file, and then process each XML file to generate separate language-variant XHTML files? For example, say we have a file foo.xml which contains, in part, something like the following:
1
1605
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 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.StyleSheet -o C:\bin\merged_lrv_gps_and_trans_tab_delim.xml C:\bin\lrv_trans.xml
4
14230
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 example, if I type in www.mysite.com?geid=0000123468 I want to display only AccessReview/Report where GEID='0000123468'. I appreciate any help you can provide. Corey
7
21612
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 server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
5
3744
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 following code fragments in which I want to list through all files on a directory with a link to download each file by passing a filename and whether or not to force the download dialog box to appear.
2
2028
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}" xslt="${xslt}"> <x:param name="statusFilter"> ABCD </x:param>
1
5088
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 from callig HTML instead of "1234567" and "mike" in XML-File) . ******* XML-File <?xml version="1.0" encoding="iso-8859-1" ?> <?xml-stylesheet href="styles_arzt.xsl" type="text/xsl" ?>
3
3153
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 somebody, please, help me out? I am on this for days. My code is as follows:
0
8231
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
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
8672
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8614
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8330
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7153
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
6107
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
4075
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...
2
1474
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.