This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Pipeline as Code and have Mohamed Labouardy on-line!
See this thread for details.
Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

XSLT choose/when problem.

Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My xml looks like this. I need to select the elements with type = b.

Can you please tell me what should be appropriate xslt:choose and xslt:when statements for this.

Instead of choosing inside for-each can I also apply the filter directly in the xsl:template match element?

Thanks Praveen.
Posts: 26475
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You wouldn't need to use xsl:choose for that. An ordinary XPath expression like /a/subvertex[xmi:type='b'] would work, assuming you were interested in getting a list of subvertex elements. And assuming you had the xmi namespace declared.

And yes, you could use that in the match attribute of an xml:template element. Generally it's better (i.e. more in tune with the XSL language) to do that than to use procedural elements like xsl:for-each.
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic