You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Krzysztof Zielinski <KZ...@supermedia.pl> on 2000/12/19 13:39:38 UTC
How to do complex query on XML documents.
Hello.
I need to do a complex query on XML documents.
Here is a small example of my problem.
I have to include to XML file each <document> tags from document.xml which
ID is in listDocumentsId.xml in listDocumentsId/documentID/@ID
I can make whole complex query in xsl file (see notNiceIndex.xsl and
notNiceIndex.xml). But it isn’t nice because I make logic in stylesheet and
I don’t separate logic and stylesheet.
I should separate logic and stylesheet.
In example indexNeededLogicsheet.xml data is in XML file, logic is in
logicsheet (I need this) and visualize is in stylesheet.
So I need a logicsheet able to process indexNeededLogicsheet.xml file and
fill tag <neededLogicSheet:myComplexQueryInXSL> with result xsl inside this
tag.
I found a good solution in project Kwelt http://db.cis.upenn.edu/Kweelt.
„Kweelt implements a query language for XML that satisfies all the
requirements from the W3C query-language-requirements”
I could not run this tool with Cocoon 1.8.
Infozone has a perfect solution Lexus for updating XML documents but what
about querying XML documents?
I think that xsl is good for this but how to use xsl with logicsheet? I
found compiled xsl from SUN but this is still in alpha.
There is FP taglib in cocoon. Is it possible to use FP as logicsheet to
solve my problem?
I am trying to find other solution.
May be someone has logicsheet in Cocoon 1 or 2 that satisfies my
requirements.
Regards,
Krzysztof Zielinski
Web Application developer
kzielinski@supermedia.pl
ICQ # 47933362
Example XML files:
listDocumentsId.xml:
<?xml version="1.0" encoding="UTF-8"?>
<listDocumentsId>
<documentID ID=’1’/>
<documentID ID=’2’/>
<documentID ID=’3’/>
</listDocumentsId>
documents.xml:
<?xml version="1.0" encoding="UTF-8"?>
<document ID='1'>
bla bla
</document>
<document ID='2'>
bla bla
</document>
<document ID='3'>
bla bla
</document>
<document ID='4'>
bla bla
</document>
<document ID='5'>
bla bla
</document>
<document ID='6'>
bla bla
</document>
notNiceIndex.xml
<?xml-logicsheet href="notNiceIndex.xsl "?>
<?cocoon-process type="xslt"?>
<index/>
notNiceIndex.xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='listDocumentsID'>
<xsl:for-each select="documentID">
<xsl:variable name="docID" select="documentID/@ID"/>
<xsl:apply-templates
select="document('Documents.xml')/document[@ID='$docID']"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
indexNeededLogicsheet.xml
<?xml-stylesheet href="OtherStylesheet.xsl" type="text/xsl"?>
<?cocoon-process type="xsp"?>
<?xml-logicsheet href="neededLogicSheet.xsl"?>
<?cocoon-process type="xslt"?>
<index>
<neededLogicSheet:myComplexQuryInXSL>
<xsl:template match='listDocumentsID'>
<xsl:for-each select="documentID">
<xsl:variable name="docID" select="documentID/text()"/>
<xsl:apply-templates
select="document('Documents.xml')/document[@ID='docID']"/>
</xsl:for-each>
</xsl:template>
</neededLogicSheet:myComplexQuryInXSL>
</index>
Re: How to do complex query on XML documents.
Posted by Lars Martin <la...@smb-tec.com>.
On Tue, 19 Dec 2000 13:39:38 +0100
"Krzysztof Zielinski" <KZ...@supermedia.pl> wrote:
> Hello.
> I need to do a complex query on XML documents.
>
>
> Here is a small example of my problem.
> I have to include to XML file each <document> tags from document.xml which
> ID is in listDocumentsId.xml in listDocumentsId/documentID/@ID
>
> I can make whole complex query in xsl file (see notNiceIndex.xsl and
> notNiceIndex.xml). But it isnt nice because I make logic in stylesheet and
> I dont separate logic and stylesheet.
>
>
> I should separate logic and stylesheet.
> In example indexNeededLogicsheet.xml data is in XML file, logic is in
> logicsheet (I need this) and visualize is in stylesheet.
>
> So I need a logicsheet able to process indexNeededLogicsheet.xml file and
> fill tag <neededLogicSheet:myComplexQueryInXSL> with result xsl inside this
> tag.
>
>
>
>
>
>
> I found a good solution in project Kwelt http://db.cis.upenn.edu/Kweelt.
> Kweelt implements a query language for XML that satisfies all the
> requirements from the W3C query-language-requirements
> I could not run this tool with Cocoon 1.8.
>
> Infozone has a perfect solution Lexus for updating XML documents but what
> about querying XML documents?
Lexus (the implementation of XUpdate) was developed to allow updates of
XML Documents. To select the nodes which you want to update you have to
specify the proper XPath that "points" to the node.
> I think that xsl is good for this but how to use xsl with logicsheet? I
> found compiled xsl from SUN but this is still in alpha.
>
> There is FP taglib in cocoon. Is it possible to use FP as logicsheet to
> solve my problem?
Prowler's Taglib provides tags to select an XPath from one or more XML
Documents. But I don't know if this Taglib is useful without the whole
bunch of Session-related stuff.
> I am trying to find other solution.
> May be someone has logicsheet in Cocoon 1 or 2 that satisfies my
> requirements.
>
>
>
>
> Regards,
> Krzysztof Zielinski
> Web Application developer
> kzielinski@supermedia.pl
> ICQ # 47933362
>
>
>
>
>
> Example XML files:
>
> listDocumentsId.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <listDocumentsId>
> <documentID ID=1/>
> <documentID ID=2/>
> <documentID ID=3/>
> </listDocumentsId>
>
> documents.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <document ID='1'>
> bla bla
> </document>
> <document ID='2'>
> bla bla
> </document>
> <document ID='3'>
> bla bla
> </document>
> <document ID='4'>
> bla bla
> </document>
> <document ID='5'>
> bla bla
> </document>
> <document ID='6'>
> bla bla
> </document>
>
> notNiceIndex.xml
> <?xml-logicsheet href="notNiceIndex.xsl "?>
> <?cocoon-process type="xslt"?>
> <index/>
>
> notNiceIndex.xsl:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match='listDocumentsID'>
> <xsl:for-each select="documentID">
> <xsl:variable name="docID" select="documentID/@ID"/>
> <xsl:apply-templates
> select="document('Documents.xml')/document[@ID='$docID']"/>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
>
>
> indexNeededLogicsheet.xml
> <?xml-stylesheet href="OtherStylesheet.xsl" type="text/xsl"?>
> <?cocoon-process type="xsp"?>
> <?xml-logicsheet href="neededLogicSheet.xsl"?>
> <?cocoon-process type="xslt"?>
> <index>
> <neededLogicSheet:myComplexQuryInXSL>
> <xsl:template match='listDocumentsID'>
> <xsl:for-each select="documentID">
> <xsl:variable name="docID" select="documentID/text()"/>
> <xsl:apply-templates
> select="document('Documents.xml')/document[@ID='docID']"/>
> </xsl:for-each>
> </xsl:template>
> </neededLogicSheet:myComplexQuryInXSL>
> </index>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
--
______________________________________________________________________
Lars Martin mailto:lars@smb-tec.com
SMB GmbH http://www.smb-tec.com