Is there a shorter way of doing if statements than actually doing xsl:if for each one? I want to attach a file to certain pages with a macro based on their node id, it seems like doing an if statement for each one could get a bit sloppy as i continue to add pages / attachments. Is there some other way of approaching this?
I agree - it does not sound like you want to maintain a lot of similar if's. Is it possible for you to add specific id's, properties or doctypes to the individual pages/files to distinguish them from each other.
Is it possible to update an xsl variable from an if statement? That would at least clean up the "business" side from the macro and the if statements could just change the variable...
As an arlternative to modify variables you often can do specific calls to tamples (using xsl:call-template) and then pass the new variable value as parameter.
You could try reversing the logic, by adding a new property to the document-type called "hasAttachment" (as a true/false checkbox), then in your XSLT, check if has been set, i.e.
xsl if array?
Is there a shorter way of doing if statements than actually doing xsl:if for each one? I want to attach a file to certain pages with a macro based on their node id, it seems like doing an if statement for each one could get a bit sloppy as i continue to add pages / attachments. Is there some other way of approaching this?
I agree - it does not sound like you want to maintain a lot of similar if's. Is it possible for you to add specific id's, properties or doctypes to the individual pages/files to distinguish them from each other.
>Tommy
Is it possible to update an xsl variable from an if statement? That would at least clean up the "business" side from the macro and the if statements could just change the variable...
nope, you cannot change a variable value. But if possible you can make a variable with the if's embedded inside:
As an arlternative to modify variables you often can do specific calls to tamples (using xsl:call-template) and then pass the new variable value as parameter.
Hi Amir,
You could try reversing the logic, by adding a new property to the document-type called "hasAttachment" (as a true/false checkbox), then in your XSLT, check if has been set, i.e.
Cheers, Lee.
Hi Amir,
You can use an XML variable structured to your own liking, and create the necessary output for them, like this:
/Chriztian
is working on a reply...