Search

Hi,

I have an apply-templates problem.

This: http://textsnip.com/1a19db/html works as it should; giving each item in the list.

However this: http://textsnip.com/46ef2a/html only gives the first item in the list.

Are they not doing the same thing?

xml= data>test>entry>tag-list>item

Any ideas?

Thanks in advance, o~

They're not doing the same thing. The first has a template that will get applied to each item, while the second's template gets applied to each tag-list. There's nothing in the second telling it to iterate over the items if there's more than one.

Thanks for the help.

...but I've been following this: http://archive.overture21.com/screencasts/apply-templates.mov tutorial and it has:

http://img23.imageshack.us/img23/6924/ss20090211231330st1.png

...which gives each 'book' in the 'library'.

I don't see how this is different to what I have in my second example.

The template in the tutorial example matches every single book node. Your second snippet of code, as I said, has a template that only matches each tag-list node. If your tag-list contains multiple items, there's nothing in your second snippet telling it to iterate over those items. You'd need something like this snippet instead.

Thanks, that very was helpful. I'm slowly starting to piece it together now.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details