[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-cocoon-users
Subject:    RE: Output xsl --- next trap
From:       "Luca Morandini" <luca.morandini1 () tin ! it>
Date:       2002-09-30 17:48:18
[Download RAW message or body]

Jessica,

good, now I can sort it out:

1) The XML produced by the XSP is not particolarly suited to the purpose; a better \
output is attached as myfile.xml (please, note the embedding of "chapter" and \
"paragraph" elements)

2) The XSLT you wrote is "procedural", but should be "declarative" instead. A \
complete re-work of your XSLT is attached as myfile.xsl (I took the liberty of adding \
some HTML formatting to further clarify the document's structure)

At the end of the day:

<advices>
	<advice type="wise">
		Get yourself "XSLT" by Doug Tidwell (O'Reilly) and start studying it:
		XSLT does matter, you won't regret learning it
	</advice>
	<advice type="unabashed self-promoting">
		Get some mentoring by a Cocoon/XSLT consultant who happens to
		live in Italy...
	</advice>
</advices>

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Jessica Niewint [mailto:j.niewint@kiosco.org]
> Sent: Monday, September 30, 2002 6:40 PM
> To: cocoon-users@xml.apache.org
> Subject: RE: Output xsl --- next trap
> 
> 
> 
> > you have a pipeline, do you ? You just have to comment the transformation
> > stage and  change the serializer from HTML to XML of that
> > pipeline, something like:
> > 
> > <map:match name="wildcard" pattern="foo.xml">
> > <map:generate type="serverpages" src="xsp/foo.xsp"/>
> > <!-- Commented out for debug
> > <map:transform type="xslt" src="bar.xsl"/>
> > <map:serialize type="html"/>
> > -->
> > <map:serialize type="xml"/> <!-- XML output for debug -->
> > </map:match>
> 
> Thank you, that you have been so patient ...  this is my xml out:
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Document xsi:noNamespaceSchemaLocation="schema.xsd"
> xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
> xmlns:esql="http://apache.org/cocoon/SQL/v2"
> xmlns:xsp="http://apache.org/xsp"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <DocObj>dummy content doc 1</DocObj>
> <DocTitle>title document 1</DocTitle>
> <DocVer>10</DocVer>
> <DocAuth>Author1</DocAuth>
> <DocDate>2002-09-19</DocDate>
> <Section>
> <SecTitle>Section A</SecTitle>
> <SecContent>Content of section A</SecContent>
> <Chapter>
> <ChapTitle>chapter 3</ChapTitle>
> <ChapContent>content chapter 3</ChapContent>
> <Paragraph>
> <ParaTitle>Paragraph 5</ParaTitle>
> <ParaContent>Content of Paragraph
> 5</ParaContent>
> <ParaTitle>Paragraph 4</ParaTitle>
> <ParaContent>Content of Paragraph
> 4</ParaContent>
> </Paragraph>
> <ChapTitle>chapter 2</ChapTitle>
> <ChapContent>content chapter 2</ChapContent>
> <Paragraph>
> <ParaTitle>Paragraph 2</ParaTitle>
> <ParaContent>Content of Paragraph
> 2</ParaContent>
> </Paragraph>
> <ChapTitle>chapter 1</ChapTitle>
> <ChapContent>content chapter 1</ChapContent>
> <Paragraph>
> <ParaTitle>Paragraph 1</ParaTitle>
> <ParaContent>Content of Paragraph
> 1</ParaContent>
> <ParaTitle>Paragraph 3</ParaTitle>
> <ParaContent>Content of Paragraph
> 3</ParaContent>
> </Paragraph>
> </Chapter>
> <SecTitle>Section B</SecTitle>
> <SecContent>Content of section B</SecContent>
> <Chapter>
> <ChapTitle>chapter 4</ChapTitle>
> <ChapContent>content chapter 4</ChapContent>
> <Paragraph>
> <ParaTitle>Paragraph 6</ParaTitle>
> <ParaContent>Content of Paragraph
> 6</ParaContent>
> </Paragraph>
> <ChapTitle>chapter 5</ChapTitle>
> <ChapContent>content chapter 5</ChapContent>
> <Paragraph>
> <ParaTitle>Paragraph 7</ParaTitle>
> <ParaContent>Content of Paragraph 7
> </ParaContent>
> </Paragraph>
> </Chapter>
> </Section>
> </Document>
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 


["myfile.xml" (text/xml)]

<?xml version="1.0" encoding="UTF-8"?>
<Document xsi:noNamespaceSchemaLocation="schema.xsd"
	xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
	xmlns:esql="http://apache.org/cocoon/SQL/v2"
	xmlns:xsp="http://apache.org/xsp"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


         <DocObj>dummy content doc 1</DocObj>
         <DocTitle>title document 1</DocTitle>
         <DocVer>10</DocVer>
         <DocAuth>Author1</DocAuth>
         <DocDate>2002-09-19</DocDate>
         <Section>
                 <SecTitle>Section A</SecTitle>
                 <SecContent>Content of section A</SecContent>
                 <Chapter>
                         <ChapTitle>chapter 3</ChapTitle>
                         <ChapContent>content chapter 3</ChapContent>
                         <Paragraph>
                                 <ParaTitle>Paragraph 5</ParaTitle>
                                 <ParaContent>Content of Paragraph 5</ParaContent>
                         </Paragraph>
                         <Paragraph>
                                 <ParaTitle>Paragraph 4</ParaTitle>
                                 <ParaContent>Content of Paragraph 4</ParaContent>
                         </Paragraph>
                 </Chapter>
                 <Chapter>
                         <ChapTitle>chapter 2</ChapTitle>
                         <ChapContent>content chapter 2</ChapContent>
                         <Paragraph>
                                 <ParaTitle>Paragraph 2</ParaTitle>
                                 <ParaContent>Content of Paragraph 2</ParaContent>
                         </Paragraph>
                 </Chapter>
                 <Chapter>
                         <ChapTitle>chapter 1</ChapTitle>
                         <ChapContent>content chapter 1</ChapContent>
                         <Paragraph>
                                 <ParaTitle>Paragraph 1</ParaTitle>
                                 <ParaContent>Content of Paragraph 1</ParaContent>
                         </Paragraph>
                         <Paragraph>
                                 <ParaTitle>Paragraph 3</ParaTitle>
                                 <ParaContent>Content of Paragraph 3</ParaContent>
                         </Paragraph>
                 </Chapter>
         </Section>
         <Section>
                 <SecTitle>Section B</SecTitle>
                 <SecContent>Content of section B</SecContent>
                 <Chapter>
                         <ChapTitle>chapter 4</ChapTitle>
                         <ChapContent>content chapter 4</ChapContent>
                         <Paragraph>
                                 <ParaTitle>Paragraph 6</ParaTitle>
                                 <ParaContent>Content of Paragraph 6</ParaContent>
                         </Paragraph>
                 </Chapter>
                 <Chapter>
                         <ChapTitle>chapter 5</ChapTitle>
                         <ChapContent>content chapter 5</ChapContent>
                         <Paragraph>
                                 <ParaTitle>Paragraph 7</ParaTitle>
                                 <ParaContent>Content of Paragraph 7</ParaContent>
                         </Paragraph>
                 </Chapter>
         </Section>
</Document>

["myfile.xsl" (text/xml)]

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

	<xsl:template match="/">

		<html>
        	<head/>

            <body>

				<xsl:apply-templates/>

            </body>
		</html>

	</xsl:template>

	<xsl:template match="Document">

		<ul>
			<li>
				Titolo: <xsl:value-of select="DocTitle"/>
				<br/>
				Oggetto: <xsl:value-of select="DocObj"/>
				<br/>
				Versione:<xsl:value-of select="DocVer"/>
			</li>

			<xsl:apply-templates select="Section"/>
		</ul>

	</xsl:template>

	<xsl:template match="Section">

		<ul>
			<li>
				Sezione: <xsl:value-of select="SecTitle"/>
				<br/>
				Commento:<xsl:value-of select="SecContent"/>
			</li>

			<xsl:apply-templates select="Chapter"/>
		</ul>

	</xsl:template>

	<xsl:template match="Chapter">

		<ul>
			<li>
				Capitolo: <xsl:value-of select="ChapTitle"/>
				<br/>
				Commento:<xsl:value-of select="ChapContent"/>
			</li>

			<xsl:apply-templates select="Paragraph"/>
		</ul>

	</xsl:template>

	<xsl:template match="Paragraph">

		<ul>
			<li>
				Paragrafo: <xsl:value-of select="ParaTitle"/>
				<br/>
				Commento:<xsl:value-of select="ParaContent"/>
			</li>
		</ul>

	</xsl:template>

</xsl:stylesheet>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic