Jump to content

xsl: if statement + xsl:variable


mbr

Recommended Posts

Hi there,i am a xslt starter and i need some help - thanx in advance!My goal is to create a html-documentation of an XSD file. I just want to list allcomplexTypes/simpleTypes and their attributes in tables and add some comments.I just looped through them with a simple for-each statement and used the different templates.Everything works fine - bingo! What i am now trying to do is the same thing, but in an "recursive-ish" way.I do the following now: I pick my first complexType, process/display it and theni call the complexType template again for every complexType i find within it.And so on... Works fine! (Result of that is a different order, wich is kinda cool for my task - beyond that,ist a good exercise for me ;-) But my problem is, that some of the complexTypes are used in different places, and becauseof that, they will be displayed more then once. Not so cool...Therefore i would like to install a if statment that checks if the current Typewas allready processed in some place.But i dont have a clue how to do that in xsl... I would need something like a list, in wich i storeall the complexType - "Names" wich i have allready used and then compare the current name with that.But it seems that there are only constants in xsl...I hope my question is clear! If you need a example/code or whatever, let me know Thanx for some Input!mario

Link to comment
Share on other sites

You can pass parameters to templates and you could store the element or names of types in a parameter you pass to the template.
...ok i will try this out. Untill now i just worked with xsl:variables (wich act like constants), so it was not possible to string "names" together.Maybe it can be done with parameters.... i will see!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...