How can I get just a part of XML node text?
I have this piece of XML:
<CorpusLink>../Metadata/A_short_autobiography_of_Herculino_Alves.xml</CorpusLink>
<CorpusLink >../Metadata/Wordlist_and_phrases_-_modifiers.xml</CorpusLink>
<CorpusLink >../desano-silva-0151/Metadata/Wordlist_fruits_and_cultural_items.xml</CorpusLink>
<CorpusLink >../desano-silva-0151/Metadata/The_Turtle_and_the_Deer.xml</CorpusLink>
<CorpusLink >../desano-silva-0151/Metadata/Wordlist_and_phrases_parts_of_a_tree.xml</CorpusLink>
<CorpusLink >../desano-silva-0151/Metadata/Wordlist_and_phrases_.xml</CorpusLink>
I need to extract only this piece of text in each one:
../Metadata
../desano-silva-0151/Metadata
I have this code :
$j = 0
$TrgContent.METATRANSCRIPT.Corpus.CorpusLink | ForEach-Object {
[String]$_.'#text'= % {$alltext[$j] + "xml" $j++}}
But it gives me all the text:
../Metadata/A_short_autobiography_of_Herculino_Alves.xml
../desano-silva-0151/Metadata/Wordlist_fruits_and_cultural_items.xml
Thanks in advance for any help.