This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
xalan-java xslt node value
- From: "Jason S" <jasonsmith at knology dot net>
- To: <XSL-List at lists dot mulberrytech dot com>
- Date: Wed, 11 Sep 2002 11:11:16 -0500
- Subject: [xsl] xalan-java xslt node value
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello list,
I am quite new to xslt, but here is my problem:
I am using xalan-java on the command line to process an xml file similar to
the snippet here:
-----------------------------
<content
docpath="/feeds/megasports/2002/09/08/SCOREBRD/2240-62980-2000AP-Sunday-Scor
es" revision-id="1" language="en-US" slug="1031514141.txt"
publish-state="new" >
<sports-content>
<sports-metadata date-time="2002-09-08T15:42:00-4:00" language="en-US"
stats-coverage="standard" fixture-key="scoreboard"
fixture-source="iptc.org" fixture-name="Scoreboard" >
<sports-title>
Sunday's Sports Scoreboard
</sports-title>
</sports-metadata>
<schedule content-label="Major League Baseball,American League" >
<schedule-metadata>
<sports-content-codes>
<sports-content-code code-type="sport" code-key="15007000"
code-source="iptc.org" code-name="baseball" >
</sports-content-code>
<sports-content-code code-type="league" code-key="l.mlb.com"
code-source="iptc.org" code-name="Major League Baseball" >
</sports-content-code>
</sports-content-codes>
</schedule-metadata>
</schedule>
</sports-content>
</content>
----------------------------------
Here is a portion of my xslt:
----------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="schedule">
<xsl:if
test="schedule-metadata/sports-content-codes/sports-content-code/@code-key='
l.mlb.com'">
INSERT INTO
(doc_id,datetime,stats_coverage,fixture_key,fixture_name,sports_title,conten
t_label,code_key
coverage_type,site_name,site_alignment,event_key,event_status,start_datetime
,inning_value,inning_half,hometeam_key,
hometeam_name,hometeam_score,hometeam_outcome,awayteam_key,awayteam_name,awa
yteam_score,awayteam_outcome)
VALUES
<xsl:value-of select="../sports-metadata/sports-title"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
-------------------------------------
As you can see, I am trying to generate sql insert statements from the data
in the xml file above. However, the node value for the 'sports-title'
element above is ALWAYS included in my output after processing. I cannot
seem to be able to stop this. No matter how I arrange my xslt, if any output
is generated, then the the 'sports-title' node value is always there in the
output.
How can I prevent the sports-title value from being included in my output?
Any help would be appreciated.
js
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list