xpath basics: axes
Anne Schumann <[email protected]> Mon, 29 Jul 2013 15:39:32 +0200
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <CA+2yfi3fjAqSrgoG_ytj_bxKsEg45CcRH+Kqg48bScMy5WKw_Q@mail.gmail.com> |
--===============2059234322==
Content-Type: multipart/alternative; boundary=047d7b67239a52701e04e2a69f0a
--047d7b67239a52701e04e2a69f0a
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Dear list members,
some time ago I asked a simple question about using XPath queries in Perl.
In the meantime, I have decided that xslt stylesheets are most appropriate
for my task. As this question now, however, is an XPath basic, I would
still like to ask it on this list:
I have a simple ddt:
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<!-- anno.dtd -->
<!ELEMENT corpus (sentence+)>
<!ELEMENT sentence (token+)>
<!ELEMENT token (#PCDATA)>
<!ATTLIST corpus name CDATA #REQUIRED>
<!ATTLIST sentence sent_id CDATA #REQUIRED>
<!ATTLIST token
id CDATA #REQUIRED
lemma CDATA #REQUIRED
isterm (true|false) #REQUIRED
pos CDATA #REQUIRED
morph CDATA #REQUIRED
dep CDATA #REQUIRED
sfun CDATA #REQUIRED
>
Normally, in each sentence there are many tokens. I would now like to find
just a linear sequence of tokens:
<xsl:when
test=3D"token[@isterm=3D'true']/following-sibling::token[1][@pos=3D',']/fol=
lowing-sibling::token[2][@lemma=3D'=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=
=B9']>
That is, I would like to find the sequence "TERM, =D0=BA=D0=BE=D1=82=D0=BE=
=D1=80=D1=8B=D0=B9",
However, adressing specific elements in the token array via [1] or [2] does
not seem to work, that is, my query ignores these indexes and randomly
retrieves elements on the following-sibling axis. Is there any mistake in
the query?
NB: Yes, my document text is in Cyrillic.
I'm grateful for any hint.
Best,
anne
--047d7b67239a52701e04e2a69f0a
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div><div><div><div><div>Dear list members,<br><br>so=
me time ago I asked a simple question about using XPath queries in Perl. In=
the meantime, I have decided that xslt stylesheets are most appropriate fo=
r my task. As this question now, however, is an XPath basic, I would still =
like to ask it on this list:<br>
<br></div>I have a simple ddt:<br><br><?xml version=3D"1.0" en=
coding=3D"UTF-8"?><br><!-- anno.dtd --><br><!ELEMENT =
corpus (sentence+)><br><!ELEMENT sentence (token+)><br><!ELEMEN=
T token (#PCDATA)><br>
<!ATTLIST corpus name CDATA #REQUIRED><br><!ATTLIST sentence sent_=
id CDATA #REQUIRED><br><!ATTLIST token <br>=9A=9A=9A id CDATA #REQUIR=
ED<br>=9A=9A=9A lemma CDATA #REQUIRED<br>=9A=9A=9A isterm (true|false) #REQ=
UIRED<br>=9A=9A=9A pos CDATA #REQUIRED<br>
=9A=9A=9A morph CDATA #REQUIRED<br>=9A=9A=9A dep CDATA #REQUIRED<br>=9A=9A=
=9A sfun CDATA #REQUIRED<br>><br><br></div>Normally, in each sentence th=
ere are many tokens. I would now like to find just a linear sequence of tok=
ens:<br><br><xsl:when test=3D"token[@isterm=3D'true']/follo=
wing-sibling::token[1][@pos=3D',']/following-sibling::token[2][@lem=
ma=3D'=CB=CF=D4=CF=D2=D9=CA']><br>
<br></div><div>That is, I would like to find the sequence "TERM, =CB=
=CF=D4=CF=D2=D9=CA",<br></div><div><br></div>However, adressing specif=
ic elements in the token array via [1] or [2] does not seem to work, that i=
s, my query ignores these indexes and randomly retrieves elements on the fo=
llowing-sibling axis. Is there any mistake in the query?<br>
</div>NB: Yes, my document text is in Cyrillic.<br><br></div>I'm gratef=
ul for any hint.<br><br></div>Best,<br>anne<br></div>
--047d7b67239a52701e04e2a69f0a--
--===============2059234322==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============2059234322==--