Reputation: 13
<ContentItem xmlns="http://endeca.com/schema/content/2008" type="GenericMarketingContent">
<TemplateId>OneRecordBanner</TemplateId>
<Name>One Record Banner</Name>
<Property name="title">
<String>Recommended</String>
</Property>
<Property name="image">
<String>green.gif</String>
</Property>
<Property name="alt_text">
<String>Image Alt text</String>
</Property>
<Property name="record_list">
<RecordSelection xmlns="http://endeca.com/schema/content/xtags/2010">
<RecordList>
<Record key="pp500231036301401000091" aggregationKey="grp_id">
<aggregationValue>pp5002310363</aggregationValue>
<label>Deer Stags Manager Mens Slip On Shoes</label>
</Record>
</RecordList>
<recordLimit>1</recordLimit>
</RecordSelection>
</Property>
</ContentItem>
/ContentItem/Property[@name='record_list']/RecordSelection/RecordList/Record/aggregationValue/text()is not fetching value. I am able to get all other values for other property tags but not this one.Can someone tell me where I am going wrong?
Upvotes: 0
Views: 65
Reputation: 3788
The element RecordSelection
and its descendants are in a different namespace than the rest of the XML document.
If you are using xslt 2.0, you can use this xpath:
/ContentItem/Property[@name='record_list']/*:RecordSelection/*:RecordList/*:Record/*:aggregationValue
A (probably cleaner) solution would be declaring the namespaces using a prefix, so that you can use this xpath:
/w1:ContentItem/w1:Property[@name='record_list']/w2:RecordSelection/w2:RecordList/w2:Record/w2:aggregationValue
withw1
being a prefix for http://endeca.com/schema/content/2008
and w2
for http://endeca.com/schema/content/xtags/2010
(Note that you don't need the final /text()
)
Upvotes: 1
Reputation: 928
RecordSelection and its children are in a different namespace, and you're not accounting for that.
The ugly hack version of fixing this would involve a bunch of local-name calls. The elegant version would be to define the namespace in your XSLT.
Upvotes: 1