This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
capturing variables or not?
- To: xsl-list at mulberrytech dot com
- Subject: capturing variables or not?
- From: "Medina, Edward" <emedina at btg dot com>
- Date: Tue, 1 Aug 2000 14:50:50 -0400
- Reply-To: xsl-list at mulberrytech dot com
Hello!
Been away for a while. My question is somewhat relating to XML (can't
really get away from it too much if I want
people to understand what I'm saying), but the focus is on XSL.
I know how to do the template match, and all that neat stuff with normal XML
(ie <tag></tag>). But now after being
away from DTDs, XML, and XSL for 2 1/2 months I have to write a style sheet
for an xml document, and I'm at a loss
on how to match these tags. (Please bear in mind I did not write the XML)
The XML is written in the following way!
<?xml version="1.0" standalone="yes"?>
<dppo:document>
<dppo:titleDef>
Fiji: Crisis Over...or is it?
</dppo:titleDef>
<dppo:packetDef>
<dppo:titleDef>
Summary
</dppo:titleDef>
<dppo:paraDef>
<dppo:textDef>
Hostages held in Parliament since 19 May 2000 were released xxx.
Ratu Josefa Iloilo will be sworn in as Fiji`s new president on
Tuesday, 18 July.
Fiji`s two-month political coup is over, but the hostage crisis is a
huge disaster for Fiji.
The fabric of multi-culturalism and harmonious race relations has
been severely strained.
The economy, which was beginning to show signs of recovery after
years of stagnation, is hobbled.
</dppo:textDef>
</dppo:paraDef>
</dppo:packetDef>
</dppo:document>
(Note: These are over simplified stylesheets, without any of the bells and
whistles)
I tired doing the following but XSLT looks at it as a variable
so it wants me to declare it as a variable.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="http://www.w3.org/TR/REC-html40"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
result-ns="fo">
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<xsl:apply-templates />
</BODY>
</HTML>
</xsl:template>
<xsl:template match="dppo:document">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
When I do, the text does display however its not really being
matched by anything except the variable declaration!
So the text cannot really be manipulated by the stylesheet
just displayed.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="http://www.w3.org/TR/REC-html40"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
result-ns="fo"
xmlns:dppo="file:/dev/null">
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<xsl:apply-templates />
</BODY>
</HTML>
</xsl:template>
<xsl:template match="dppo:document">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
I thought of trying to capture the information as a variable would
but I'm not quite sure how to do that. I began to try the following
and was not sure if it would work.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="http://www.w3.org/TR/REC-html40"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
result-ns="fo"
xmlns:dppo="file:/dev/null">
<!-- These are the variables used -->
<dppo:document document="document">
<dppo:packetDef packet="packet">
<dppo:paraDef para="para">
<dppo:titleDef title="title">....
If I could get a simple example on how to be able to match these
XML tags I would greatly appreciate it. Thanks in advance, and I hope
that I'm out of the scope of this list.
Thanks again!
Eddy
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list