0

Lets say i have the following Structure

<xmlsheet>
    <someContent>
        <directContent>hello</directContent>
        <otherDirectContent>hello again</otherDirectContent>
        <nestedContent>
            <title>Hello im a Title</title>
        </nestedContent>
    </someContent>
    <someOtherContent></someOtherContent>
</xmlsheet>

How do i select the title of nestedContent in someContent?

When i select the directContent in someContent it works like this

        <cms:contentaccess var="content" />
        <c:set var="directContent" value="${content.valueList.someContent[0].value.directContent}"/>

If i only say ${content.valueList.someContent[0].value} it will throw out direct and otherDirect content but not the nested content :<

Snackaholic
  • 590
  • 7
  • 27

1 Answers1

2

This code ${content.valueList.someContent[0].value['nestedContent/title'] works. It uses the xpath to the value. From the documentation

Map:getValue()

Returns a lazy initialized Map that provides values from the XML content in the current locale. The provided Map key is assumed to be a String that represents the xpath to the value.

See also the underlying Java API

Danil Gaponov
  • 1,413
  • 13
  • 23