|
Subject: Re: [xsl] time from server to document From: Jarkko Moilanen <Jarkko.Moilanen@xxxxxx> Date: Wed, 27 Mar 2002 10:40:05 +0200 (EET) |
Hi!
Our solution to time and date prob is:
(Xalan C and linux)
1. Use parameters in Xalan
#!/bin/sh
# This script is done for bash unix shell, but can be translated
# easily for other skripting languages too
#
#
#Path to Xalan executable
XALAN="/usr/local/xml-xalan/c/bin/Xalan"
#
#
# Used file
#
FILE=$QUERY_STRING
#
#
#All used paths
XMLFILE="/var/www/xslt/$FILE.xml"
XSLFILE="/var/www/xslt/$FILE.xsl"
OUTFILE="/var/www/xslt/xmlout/$FILE.xml"
#
#
#Parameters to Xalan
#
#
DATE="`date +"%d/%m/%Y %T"`" #Day and time
TEST="hipsu!"
#Another param
#
#
# Do the processing
#
$XALAN -p date1 "'$DATE'" -p hipsu "'$TEST'" -o $OUTFILE $XMLFILE $XSLFILE
#
#
# Lets print it all out
#
echo "Content-type: text/xml"
echo ""
cat $OUTFILE
#
#EOF
2. In the xsl file:
<xsl:output method="xml" indent="yes" standalone="no" />
HERE WE DECLARE THE PARAMETER. PARAM NEEDS TO BE OUTSIDE TEMPLATE MATCH.
<xsl:param name="date1" select="'$date1'"/>
DONT KNOW IS IT NECESSARY TO SELECT IT HERE???!!!
<xsl:template match="Information">
<LocateDate><TopicBorder>
<xsl:text>Location and Date</xsl:text>
</TopicBorder>
<Location>
<xsl:text>Location: Where ever</xsl:text>
</Location>
<Date><xsl:text>Date: </xsl:text>
HERE WE ADD IT TO THE XML FILE TO BE CREATED
<xsl:value-of select="$date1" />
</Date>
3. And the result is:
<LocateDate>
<TopicBorder>Location and Date</TopicBorder>
<Location>Location: Where ever</Location>
<Date>Date: 27/03/2002 10:11:35</Date>
</LocateDate>
So thanks to everyone who answered to my question.
*******************************************************************
Jarkko Moilanen You are wise, witty, and wonderful,
Research/ ITCM but you spend too much time
jarkko.moilanen@xxxxxx reading this sort of trash.
www.uta.fi/~jm60697
GSM: +358 50 3766 927
*******************************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] html2xml?, Daniel Veillard | Thread | Re: [xsl] time from server to docum, cutlass |
| [xsl] Re: [xsl] 答复: [xsl] how to ch, cutlass | Date | [xsl] 答复: [xsl] how to change xml E, dragon |
| Month |