Re: perl-ish way to deal with footnotes in an XML document
by Birgit Kellner other posts by this author
Jul 19 2007 9:48AM messages near this date
view in the new Beta List Site
RE: perl-ish way to deal with footnotes in an XML document
|
RE: perl-ish way to deal with footnotes in an XML document
& XSLT Thomas, Mark - BLS CTR schrieb:
> Birgit Kellner wrote:
>
> > <seg>This is a segment of text. It goes on and on. <note><span
> > type="lemma">Here</span>
> > <app>
> > <lem>Here</lem>
> > <rdg wit="Ms-A">Here</rdg>
> > <rdg wit="Ms-B">There</rdg>
> > </app>
> > </note>
> > there is a note, but after the note the text continues.</seg>
> >
> > How can I get whatever code I wish to create for the note to be
> > inserted
> > *exactly* at the start of the <note>-Element,
> >
>
> Each text segment is a different node. In other words, <seg> has three
> children:
> 1. A text node containing "This is a segment... on and on. "
> 2. A <note> element
> 3. A text node containing "there is a note... continues."
>
> So doing what you want to do is not a problem.
>
> - Mark.
>
>
>
That's good to know. Do you have any suggestions how exactly I might go
about it, then?
I tried this with XML::LibXML:
my $children = $seg-> findnodes('child::*');
foreach my $child ($children-> get_nodelist) {
print $child-> textContent ;
my $name = $child-> nodeName;
print "$name \n";
}
While the code correctly returns the <note> -Element, it doesn't return
the text node; actually it returns the text content of <seg> ; instead,
it returns the text content of all <rdg> -elements.
Thanks,
Birgit
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Birgit Kellner
Mark - BLS CTR Thomas
Birgit Kellner
Mark - BLS CTR Thomas
A. Pagaltzis
Birgit Kellner
Joshua Santelli
Petr Pajas
|