You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ulrich Mayring <ul...@denic.de> on 2000/06/14 11:37:59 UTC

XInclude Processor

Hello,

do I understand it correctly that a <xinclude:include> directive can
only be used as a child of the root tag? Is it possible to include XML,
that ends up somewhere further down the tree?

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

Re: XInclude Processor

Posted by Giacomo Pati <Gi...@pwr.ch>.
Sorry for this. I've replied to the wrong mail.

Giacomo

Giacomo Pati wrote:
> 
> Donald Ball wrote:
> >
> > On Thu, 15 Jun 2000, sudhi wrote:
> >
> > > Hi,
> > > I was trying XInclude. I come upto a point, where I don't know what to
> > > do.
> > > Any help would be appreciated.
> >
> > Are you using cocoon-1.7.4 or cocoon-1.7.5dev (from CVS)?
> 
> Always latest from CVS. But the pages I've  written are about two month
> old. They had worked then and they still work now!
> 
> Giacomo
> 
> >
> > - donald
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 
> --
> PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
> Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
> Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
> CH-8166 Niederweningen                    Web:   http://www.pwr.ch
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: XInclude Processor

Posted by Giacomo Pati <Gi...@pwr.ch>.
Donald Ball wrote:
> 
> On Thu, 15 Jun 2000, sudhi wrote:
> 
> > Hi,
> > I was trying XInclude. I come upto a point, where I don't know what to
> > do.
> > Any help would be appreciated.
> 
> Are you using cocoon-1.7.4 or cocoon-1.7.5dev (from CVS)?

Always latest from CVS. But the pages I've  written are about two month
old. They had worked then and they still work now!

Giacomo

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

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: XInclude Processor

Posted by sudhi <su...@planet.net>.
Hi,
The is the main page. I want to generate the name of the file to be
included using xsp.
-------------------------------------------
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xinclude"?>

<xsp:page language="java" 
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
>

<page>
  <xsp:logic>
   String url = "body.xml";
  </xsp:logic>
  <TITLE>This is title</TITLE>
  <xinclude:include parse="xml"><xsp:attribute
name="href"><xsp:expr>url</xsp:expr></xsp:attribute></xinclude:include>
</page>
</xsp:page>
-------------------------------------------

This is what I see when I request this page and view source.

-------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<page>
  
  <TITLE>This is title</TITLE>
  <xinclude:include href="body.xml" parse="xml"></xinclude:include>
</page>

<!-- This page was served in 362 milliseconds by Cocoon 1.7.4 -->
-------------------------------------------

Even this page wont work.
-------------------------------------------
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xinclude"?>
<xsp:page language="java"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
>
<page>
  <TITLE>This is title</TITLE>
  <xinclude:include parse="xml" href="body.xml"></xinclude:include>
  <xsp:logic>
   String url = "body.xml";
  </xsp:logic>
  <pagename>
    <xsp:expr>url</xsp:expr>
  </pagename>
</page>
</xsp:page>
-------------------------------------------

~Sudhi

Re: XInclude Processor

Posted by Ulrich Mayring <ul...@denic.de>.
Donald Ball wrote:
> 
> On Mon, 19 Jun 2000, sudhi wrote:
> 
> > No Donald, It wont work.
> > If I include xsp pi first and then xinclude PI. xinclude wont work. It
> > leaves the xinclude tags as is.
> > I am using Cocoon 1.7.4.
> 
> queer. do you mind sending me a copy of your page?

I had this problem, too. It happens with any kind of a page, really.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

Re: XInclude Processor

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 19 Jun 2000, sudhi wrote:

> No Donald, It wont work.
> If I include xsp pi first and then xinclude PI. xinclude wont work. It
> leaves the xinclude tags as is.
> I am using Cocoon 1.7.4.

queer. do you mind sending me a copy of your page?

- donald


Re: XInclude Processor

Posted by sudhi <su...@planet.net>.
No Donald, It wont work.
If I include xsp pi first and then xinclude PI. xinclude wont work. It
leaves the xinclude tags as is.
I am using Cocoon 1.7.4.
~S

Donald Ball wrote:
> 
> On Fri, 16 Jun 2000, sudhi wrote:
> 
> > Thanks a lot Donald,
> > I am eagerly waiting for that release :-)
> > By the way,
> > can I use xsp before xinclude ?
> 
> can't see any reason why not, but you're probably better off using the
> util:include stuff in that scenario.
> 
> - donald
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: XInclude Processor

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 16 Jun 2000, sudhi wrote:

> Thanks a lot Donald,
> I am eagerly waiting for that release :-)
> By the way,
> can I use xsp before xinclude ?

can't see any reason why not, but you're probably better off using the
util:include stuff in that scenario. 

- donald


Re: XInclude Processor

Posted by sudhi <su...@planet.net>.
Thanks a lot Donald,
I am eagerly waiting for that release :-)
By the way,
can I use xsp before xinclude ?
Thanks
Sudhi

Donald Ball wrote:
> 
> On Fri, 16 Jun 2000, sudhi wrote:
> 
> > Cocoon-1.7.4
> 
> your problem has likely been fixed in CVS. I'll try to get a real release
> pushed out sometime shortly in case you can't build CVS.
> 
> - donald
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: XInclude Processor

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 16 Jun 2000, sudhi wrote:

> Cocoon-1.7.4

your problem has likely been fixed in CVS. I'll try to get a real release
pushed out sometime shortly in case you can't build CVS.

- donald


Re: XInclude Processor

Posted by sudhi <su...@planet.net>.
Cocoon-1.7.4


~Sudhi

Donald Ball wrote:
> 
> On Thu, 15 Jun 2000, sudhi wrote:
> 
> > Hi,
> > I was trying XInclude. I come upto a point, where I don't know what to
> > do.
> > Any help would be appreciated.
> 
> Are you using cocoon-1.7.4 or cocoon-1.7.5dev (from CVS)?
> 
> - donald
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: XInclude Processor

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 15 Jun 2000, sudhi wrote:

> Hi,
> I was trying XInclude. I come upto a point, where I don't know what to
> do.
> Any help would be appreciated.

Are you using cocoon-1.7.4 or cocoon-1.7.5dev (from CVS)?

- donald


Re: XInclude Processor

Posted by sudhi <su...@planet.net>.
Hi,
I was trying XInclude. I come upto a point, where I don't know what to
do.
Any help would be appreciated.

This is my xml page.

---------------------------------
<?xml version="1.0" standalone="no"?>
<?cocoon-process type="xinclude"?>
<?cocoon-format type="text/xml"?>

<page xmlns:xinclude="http://www.w3.org/1999/XML/xinclude">
  <xinclude:include parse="xml" href="body.xml"/>
</page>
---------------------------------

this is body.xml
-----------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CONTENT>
 This is content
</CONTENT>
-----------------------------------

When I try this, I get a NullPointerException. This is what I get these
messages in error_log.

-------------------------
basename: /export/home/msds/apache/apache/htdocs/work/xinclude.xml
Processing element: [page: null]
Name: page
URI: 
Processing element: [xinclude:include: null]
Name: include
URI: http://www.w3.org/1999/XML/xinclude
Processing XInclude element: href=body.xml, parse=xml
File: /export/home/msds/apache/apache/htdocs/work/body.xml
Object: java.io.FileReader@1fa50b1d
Parse type is XML
-------------------------

I don't know where to look for the error. This wont work on windows NT
since java.io.File().getParent() will return null.
I am using 
jdk1.1.8
JSDK2.0
Apache 1.3.12
ApacheJserv 1.1.1
Cocoon 1.7.4
on Sun Solaris box
Any help would be appriciated.
I saw a similar post. But no patches or no suggestion.(
http://xml-archive.webweaving.org/xml-archive-cocoon-users/3660.html )
TIA
Sudhi

Re: XInclude Processor

Posted by Ulrich Mayring <ul...@denic.de>.
iana@cinesite.co.uk wrote:
 
> <root>
>   <xinclude:include..../>
> </root>
> 
> but not:
> 
> <root>
>   <subroot>
>      <xinclude:include..../>
>   <subroot>
> </root>

Ian,

thanks a lot for your help, but it turned out that I was using an
outdated version of the XInclude processor (the one from 1.7.4, instead
of from CVS). I also sent a correction to this list, unfortunately you
missed it. Again, sorry for the inconvenience.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

Re: XInclude Processor

Posted by Ian Abbott <ia...@cinesite.co.uk>.
Ian Abbott wrote:
> 
> blah blah blah blah...
>

Please disregard the posting I just made. Just read Ulrich posting about
disregarding his... oops :)

Ian

Re: XInclude Processor

Posted by Ian Abbott <ia...@cinesite.co.uk>.
Ulrich Mayring wrote:
> 
> Hello,
> 
> do I understand it correctly that a <xinclude:include> directive can
> only be used as a child of the root tag? Is it possible to include XML,
> that ends up somewhere further down the tree?
> 
> Ulrich
> 

I'm not sure what you mean. Do you mean that you can do:

<root>
  <xinclude:include..../>
</root>

but not:

<root>
  <subroot>
     <xinclude:include..../>
  <subroot>
</root>

I haven't had this problem. For instance, I'm using the SQL XSP taglib
in a lot of pages. Rather than redefine each time, I've split the SQL
stuff into another page called 'config.xml':-

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

<page xmlns:sql="http://www.apache.org/1999/SQL">
  <sql:driver>postgresql.Driver</sql:driver>
  <sql:dburl>jdbc:postgresql://mysite.com:5432/mydb</sql:dburl>
  <sql:username>myuser</sql:username>
  <sql:password>mypassword</sql:password>
  <sql:doc-element>ROWSET</sql:doc-element>
  <sql:row-element>ROW</sql:row-element>
  <sql:id-attribute>ID</sql:id-attribute>
  <sql:count-attribute>count</sql:count-attribute>
  <sql:query-attribute>sqlquery</sql:query-attribute>
  <sql:skip-rows-attribute>skiprows</sql:skip-rows-attribute>
  <sql:max-rows-attribute>maxrows</sql:max-rows-attribute>
  <sql:update-rows-attribute>updatedrows</sql:update-rows-attribute>
  <sql:null-indicator>y</sql:null-indicator>
  <sql:tag-case>lower</sql:tag-case>
</page>

Then my SQL XSP pages pull this data in via XInclude, but not into the
root element of the page, e.g. 'testquery.xml':-

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="gui.xsl" type="text/xsl"?>
<?cocoon-process type="xinclude"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>

<xsp:page language="java"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
  xmlns:sql="http://www.apache.org/1999/SQL">
  <page>
    <sql:execute-query>
      <xinclude:include parse="xml"
href="config.xml#xpointer(//*[namespace-uri()='http://www.apache.org/1999/SQL'])"/>
      <sql:query>SELECT DISTINCT id, name FROM testtable;</sql:query>
    </sql:execute-query>
  </page>
</xsp:page>

In the XPointer, I'm using namespace-uri rather than "//sql:*" in case
the config.xml ever gets another namespace by accident. Doubtful, but
you can never be too careful in my opinion.

Anyway, when this gets transformed, I end up with all the <sql:*> tags
imported into the <sql:execute-query/> node OK.

My next step is to be able to selectively override parameters, which is
going to involve some faffing around with the XPath in XInclude a bit
more; i.e. import all sql:* tags apart from X tag and Y tag...

So, does this fit your problem or am I babbling incoherently about the
wrong problem?

Ian