Reputation: 2659
Does someone knows the right command/path to get the ident, shortTitle And a string that begins with a " / " (Note that there is a chance that the position of that string changes in certain circumstances)
I have this block of code where I presenting the string but then I wouldn't have the ident and shortTitle
$result = $xpaths->xpath("//*[ident = '$page']/moduleConfiguration/config//string[starts-with(.,'/')]");
foreach ($result as $item) {
echo item
};
The full path is
/org.olat.course.Structure/rootNode/children/*[type = 'st' or type = 'sp' or type = 'bc']/moduleConfiguration/config/entry/string
.... <org.olat.course.nodes.STCourseNode> <ident>81473730700165</ident> <parent class="org.olat.course.nodes.STCourseNode" reference="../../.."/> <type>st</type> <shortTitle>General Information</shortTitle> <longTitle/> <learningObjectives/> <displayOption>content</displayOption> <moduleConfiguration> <config> <entry> <string>allowRelativeLinks</string> <string>false</string> </entry> <entry> <string>file</string> <string>/kgalgemeneinformatie.html</string> <--- </entry> <entry> <string>configversion</string> <int>3</int> </entry> <entry> <string>display</string> <string>file</string> </entry> </config> </moduleConfiguration> <noAccessExplanation></noAccessExplanation> <preConditionVisibility></preConditionVisibility> <preConditionAccess></preConditionAccess> <scoreCalculator></scoreCalculator> </org.olat.course.nodes.STCourseNode> ...
it would be wonderful if this could work in 1 foreach.
Kind regards
Dieter
Upvotes: 0
Views: 82
Reputation: 3209
If you're wanting them as nodes in one loop, you'll have to group them together with the '|' identifier:
//*[ident = '$page']/moduleConfiguration/config//string[starts-with(.,'/')]|//*[ident = '$page']/shortTitle|//*[ident = '$page']/ident
Or you could group them all in one node with the concatenate function:
concat(//*[ident = '$page']/moduleConfiguration/config//string[starts-with(.,'/')], //*[ident = '$page']/shortTitle, //*[ident = '$page']/ident)
Upvotes: 1