Jump to content

xsl: if statement + xsl:variable


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...