L
Larry Lindstrom
Hello Again:
I appreciate all the assistance I've received
from this group. But I'm having trouble getting
traction in my effort to understand XML.
I took some time to research this, and I tried
to figure it out, but I'm stuck on the very next
lesson in ZVON's XSLT tutorial:
http://www.zvon.org/xxl/XSLTutorial/Output/example6_ch1.html
XML Source, I added the two PI statements:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="page_03_01.xsl"?>
<source>
<bold>Hello, world.</bold>
<red>I am </red>
<italic>fine.</italic>
</source>
XSL:
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="bold">
<p>
<b>
<xsl:value-of select="."/>
</b>
</p>
</xsl:template>
<xsl:template match="red">
<p style="color:red">
<xsl:value-of select="."/>
</p>
</xsl:template>
<xsl:template match="italic">
<p>
<i>
<xsl:value-of select="."/>
</i>
</p>
</xsl:template>
</xsl:stylesheet>
Internet Explorer does fine. The appropriate
bold, red and italic words are printed.
Mozilla displays nothing, blank screen.
Ok, I'll try to make this work. Suggestions
from this group that have helped with the last
examples:
Set the output method by adding one of the
following to the XSL:
<xslutput method="html"/>
<xslutput method="xml"/>
Nothing, blank page with either one of
these.
Wrap <html> tags around the contents of the
xsl:stylesheet element:
Mozilla displays a gray screen and ignores
the right mouse button. No hint as to
the problem.
Wrap <html> tags around the contents
of the templates:
Blank screen
Comment out all but one template, leave the
<html> tags in the template.
That works! Well it works if I only want
one template.
Why don't I get more than one template in the
contents my xsl:stylesheet element? The
stylesheet is the root element, isn't it? So I
should be able to have any number of xsl:template
elements inside the stylesheet element, shouldn't
I?
When I comment out all but one template, for
example the "bold" template, why did that match?
The xml had a "/source/bold" element, how did
XSTL find "bold"? The ZVON xpath tutorial shows
"//bold" to be the syntax to find any element with
that name in the hierarchy.
I'm in serious need of some tools. Preferably
free, to display the output of the XSLT, and to
report on the correctness of the XML and XSL files.
What do you recommend?
I tried W3C's validator on both the xml and the
xsl, and was told both files need a DOCTYPE. I
don't see exactly what to enter for a DOCTYPE in
an XML or XSL file, but when I try to cut and paste
examples of DOCTYPE from W3C's "Choosing a DOCTYPE"
page, nothing good happens.
Is there a tutorial with examples that work with
Mozilla? Is the problem with tutorials depending on
Microsoft proprietary features, Mozilla's failure to
meet W3C standards, or me being an idiot?
I'm a C++ programmer, why am I having so much
trouble connecting to XML?
Thanks
Larry
I appreciate all the assistance I've received
from this group. But I'm having trouble getting
traction in my effort to understand XML.
I took some time to research this, and I tried
to figure it out, but I'm stuck on the very next
lesson in ZVON's XSLT tutorial:
http://www.zvon.org/xxl/XSLTutorial/Output/example6_ch1.html
XML Source, I added the two PI statements:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="page_03_01.xsl"?>
<source>
<bold>Hello, world.</bold>
<red>I am </red>
<italic>fine.</italic>
</source>
XSL:
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="bold">
<p>
<b>
<xsl:value-of select="."/>
</b>
</p>
</xsl:template>
<xsl:template match="red">
<p style="color:red">
<xsl:value-of select="."/>
</p>
</xsl:template>
<xsl:template match="italic">
<p>
<i>
<xsl:value-of select="."/>
</i>
</p>
</xsl:template>
</xsl:stylesheet>
Internet Explorer does fine. The appropriate
bold, red and italic words are printed.
Mozilla displays nothing, blank screen.
Ok, I'll try to make this work. Suggestions
from this group that have helped with the last
examples:
Set the output method by adding one of the
following to the XSL:
<xslutput method="html"/>
<xslutput method="xml"/>
Nothing, blank page with either one of
these.
Wrap <html> tags around the contents of the
xsl:stylesheet element:
Mozilla displays a gray screen and ignores
the right mouse button. No hint as to
the problem.
Wrap <html> tags around the contents
of the templates:
Blank screen
Comment out all but one template, leave the
<html> tags in the template.
That works! Well it works if I only want
one template.
Why don't I get more than one template in the
contents my xsl:stylesheet element? The
stylesheet is the root element, isn't it? So I
should be able to have any number of xsl:template
elements inside the stylesheet element, shouldn't
I?
When I comment out all but one template, for
example the "bold" template, why did that match?
The xml had a "/source/bold" element, how did
XSTL find "bold"? The ZVON xpath tutorial shows
"//bold" to be the syntax to find any element with
that name in the hierarchy.
I'm in serious need of some tools. Preferably
free, to display the output of the XSLT, and to
report on the correctness of the XML and XSL files.
What do you recommend?
I tried W3C's validator on both the xml and the
xsl, and was told both files need a DOCTYPE. I
don't see exactly what to enter for a DOCTYPE in
an XML or XSL file, but when I try to cut and paste
examples of DOCTYPE from W3C's "Choosing a DOCTYPE"
page, nothing good happens.
Is there a tutorial with examples that work with
Mozilla? Is the problem with tutorials depending on
Microsoft proprietary features, Mozilla's failure to
meet W3C standards, or me being an idiot?
I'm a C++ programmer, why am I having so much
trouble connecting to XML?
Thanks
Larry