You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by "Kazi the P i R @ t {-" <ka...@ewarna.com> on 2001/08/01 10:38:16 UTC
XSLT trouble
I have made a post earlier about troubl i am having performing the transformation from xml to html.
I havent reached a solution yet. But it occured to me that maybe i should lessent he scope of my troubles! :) so i cut short the xsl file. It looks like this now:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3c.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<title>A Guide to the Search Utility</title>
</head>
<body style="font-family: Arial;" bgcolor="cccccc">
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="contact">
<p><xsl:text>For more information contact the person below:</xsl:text></p>
<p>
<b><xsl:apply-templates/></b>
</p>
</xsl:template>
<xsl:template match="name">
<br/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="email">
<br/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()">
</xsl:template>
</xsl:stylesheet>
My dtd is such:
<!ELEMENT guide (buttons,how-to,contact)>
<!ELEMENT buttons (search,view,sort,warning,respond)>
<!ELEMENT how-to (description+)>
<!ELEMENT contact (name,email)>
<!ELEMENT search (text, image)>
<!ELEMENT view (text,image)>
<!ELEMENT sort (text,image)>
<!ELEMENT warning (text,image)>
<!ELEMENT respond (text,image)>
<!ELEMENT text (#PCDATA)>
<!ELEMENT image (#PCDATA)>
<!ELEMENT description (#PCDATA|sub-point)*>
<!ELEMENT sub-point (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT email (#PCDATA)>
Currently i am very lost.... so i hope anyone can shed some light on me
kazi
|
|
|
|||||||||||||||||||||||||||| o |||||||||||||||||||||||||||
Re: XSLT trouble
Posted by fr...@ontosys.com.
On Wed, Aug 01, 2001 at 04:38:16PM +0800, Kazi the P i R @ t {- wrote:
> I have made a post earlier about troubl i am having performing the
> transformation from xml to html. I havent reached a solution
> yet. But it occured to me that maybe i should lessent he scope of my
> troubles! :) so i cut short the xsl file. It looks like this now:
You didn't describe how the output HTML differs from what you want,
but from inspecting your stylesheet I'd guess that you're getting only
the HTML generated by the template that matches the root node, along
with a smattering of empty HTML elements produced by other templates.
1) You don't have templates for most of your element types, so the
default rule will apply and simply run apply-templates whenever those
elements are encountered. I'd guess that you need more templates
matching your particular element types and generating the HTML content
that you want in each case, calling apply-templates in the appropriate
HTML context.
> <xsl:template match="text()">
> </xsl:template>
2) Here you wrote your own default template for text nodes, causing
all text content to be ignored. I doubt if you meant that! Try
removing that rule first.
--
Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312
Principal Consultant www.OntoSys.com fax: +1.630.879.1370
OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: XML help needed
Posted by Matt Leinhos <ma...@granularity.com>.
You might try
file://C:\test.xml
Matt
On Aug 1, Maksim Markaitis wrote: -----------------
> how to specify fullpath to file in anyURI type?
> "test.xml" works
> "C:\test.xml" doesn't work
> thanx
>
--
Matt Leinhos
matt@granularity.net
"What's that you say, Mrs. Robinson? Joltin' Joe has left and gone away."
-- Simon and Garfunkel
---------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org
XML help needed
Posted by Maksim Markaitis <Ma...@robertsonblums.lv>.
how to specify fullpath to file in anyURI type?
"test.xml" works
"C:\test.xml" doesn't work
thanx
Re: XSLT trouble
Posted by fr...@ontosys.com.
On Wed, Aug 01, 2001 at 04:38:16PM +0800, Kazi the P i R @ t {- wrote:
> I have made a post earlier about troubl i am having performing the
> transformation from xml to html. I havent reached a solution
> yet. But it occured to me that maybe i should lessent he scope of my
> troubles! :) so i cut short the xsl file. It looks like this now:
You didn't describe how the output HTML differs from what you want,
but from inspecting your stylesheet I'd guess that you're getting only
the HTML generated by the template that matches the root node, along
with a smattering of empty HTML elements produced by other templates.
1) You don't have templates for most of your element types, so the
default rule will apply and simply run apply-templates whenever those
elements are encountered. I'd guess that you need more templates
matching your particular element types and generating the HTML content
that you want in each case, calling apply-templates in the appropriate
HTML context.
> <xsl:template match="text()">
> </xsl:template>
2) Here you wrote your own default template for text nodes, causing
all text content to be ignored. I doubt if you meant that! Try
removing that rule first.
--
Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312
Principal Consultant www.OntoSys.com fax: +1.630.879.1370
OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
---------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org