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="'	' "/> <!-- tab -->
<xsl:variable name="nl" select="'
' "/> <!-- 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}
-->
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="'	' "/> <!-- tab -->
<xsl:variable name="nl" select="'
' "/> <!-- 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}
-->
Comment