3

My XML is something like this.

.
.
.
</body>

<List>
  <topicTitle>This is topic title</topicTitle>
  <topDef>This is topic definition.</topDef>
</List>

I basically want to insert topicTitle and topDef into <li> tags. And I am trying to do so with this code (code for topicTitle shown only for simplicity):

<!-- TemplateBeginRepeat name="List" -->

    <!-- TemplateBeginRepeat name="Field.topicTitle" -->

        <li>@@RenderComponentField(FieldPath+".value", 
                                   TemplateRepeatIndex)@@ </li>
    <!-- TemplateEndRepeat -->

<!-- TemplateEndRepeat -->

But it doesn't seem to be working. Any ideas?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
smooth_smoothie
  • 1,319
  • 10
  • 27
  • 40
  • Is this XML based on a Tridion web schema (so with an embedded schema named List)? Or is this something you have in a rich-text field? – Frank van Puffelen Jun 22 '12 at 20:41
  • Also: what do you get as output? And what are the values your see for "(FieldPath=@@FieldPath@@, TemplateRepeatIndex=@@TemplateRepeatIndex@@)" (as suggested here: http://stackoverflow.com/a/10322575/209103)? – Frank van Puffelen Jun 22 '12 at 20:42
  • 1
    This will only iterate over the topicTitle field's values - doesn't seem at all like what you want to do... – Nuno Linhares Jun 22 '12 at 22:31

1 Answers1

1

In case of embeddable schema you don't need to iterate over xmlList (with TemplateBeginRepeat) unlike Component link, here you can directly access the embedded child element via syntax:-

@@Component.XMLNameOfEmbeddedschema.XmlElementNameinEmbeddedSchema@@

pls note in above XMLNameOfEmbeddedschema = the XMLName you give in parent schema while inserting an embeddable schema.

So in your scenario it will work with

@@Component.List.topicTitle@@ for accessing value of topicTitle.

Please mark this answer as accepted, if this solution works for you...

d k
  • 493
  • 2
  • 6
  • 21