You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Thomas Zastrow <ch...@thomas-zastrow.de> on 2003/12/04 11:20:15 UTC
Simple question ...
Hi there,
I've got a simple question but I was trying for hours and nothing works ...
I've some documents in Xindice looking like this:
....
<token>
something
</token>
....
This here works fine for querying attributes:
xindice xpath_query -c /db/corpora/taz -q "/corpus//token[@wclass='NN']"
But I want to access the content of the token-tag not the attributes ... so, how can I build a query like "Give me all structures where the CONTENT of the tag token is "something"" ...
Thank you,
Tom
P.S.:
I hope I didn't send these mail twice ... ??
--
----------------------------------------------------
| So ein Unsinn sich einer Sekte anzuschliessen |
| wenn man Bier zuhause hat |
|--------------------------------------------------|
| http://www.thomas-zastrow.de |
----------------------------------------------------
Re: Simple question ...
Posted by Ja...@uta.fi.
Lainaus Thomas Zastrow <ch...@thomas-zastrow.de>:
< On Thu, 4 Dec 2003 12:39:40 +0200
< Jarkko.Moilanen@uta.fi wrote:
<
< <snip />
<
< > You could use contains() see below XSLT example
< >
<
< <snip />
<
<
< As I understand you something like that should work:
<
< xindice xpath_query -c /db/corpora/taz -q "/corpus//token[contains(.,
< 'a')]"
<
< (Give me all token-tags which contains an 'a')
<
< But the result is empty ... and there are a lot of token-tags with an 'a'
< in it ... ;-(
<
< Greetings,
<
< Tom
err.... Then I dont know howto do it with xindice. Does it support the
XPath part: contains()... Maybe someone using the xindice will answer you.
Cheers,
Jarkko
***************************************************
* Jarkko Moilanen *
* Project Manager, ITCM (www.itcm.org) *
* Profound XML technology Expert *
* University of Tampere *
* Hypermedia Laboratory *
***************************************************
Re: Simple question ...
Posted by Thomas Zastrow <ch...@thomas-zastrow.de>.
On Thu, 4 Dec 2003 12:39:40 +0200
Jarkko.Moilanen@uta.fi wrote:
<snip />
> You could use contains() see below XSLT example
>
<snip />
As I understand you something like that should work:
xindice xpath_query -c /db/corpora/taz -q "/corpus//token[contains(., 'a')]"
(Give me all token-tags which contains an 'a')
But the result is empty ... and there are a lot of token-tags with an 'a' in it ... ;-(
Greetings,
Tom
--
----------------------------------------------------
| So ein Unsinn sich einer Sekte anzuschliessen |
| wenn man Bier zuhause hat |
|--------------------------------------------------|
| http://www.thomas-zastrow.de |
----------------------------------------------------
Re: Simple question ...
Posted by Ja...@uta.fi.
Lainaus Thomas Zastrow <ch...@thomas-zastrow.de>:
<
< Hi there,
<
< I've got a simple question but I was trying for hours and nothing works
< ...
<
< I've some documents in Xindice looking like this:
<
< ....
< <token>
< something
< </token>
< ....
<
<
< This here works fine for querying attributes:
<
< xindice xpath_query -c /db/corpora/taz -q "/corpus//token[@wclass='NN']"
<
< But I want to access the content of the token-tag not the attributes ...
< so, how can I build a query like "Give me all structures where the CONTENT
< of the tag token is "something"" ...
<
< Thank you,
<
< Tom
<
You could use contains() see below XSLT example
<?xml version="1.0"?><!--filename.xsl-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/"> <!--root rule-->
<xsl:for-each select="elements/element[contains(.,'Jarkko')]">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<elements>
<element>Jarkko</element>
<element>Moilanen</element>
<element>Foobar</element>
</elements>
[jarkko@hypsu02 development]$ xsltproc contains.xsl contains.xml
<?xml version="1.0"?>
<element>Jarkko</element>
Cheers,
jarkko
***************************************************
* Jarkko Moilanen *
* Project Manager, ITCM (www.itcm.org) *
* Profound XML technology Expert *
* University of Tampere *
* Hypermedia Laboratory *
***************************************************