Jump to content

create template based on test results

Recommended Posts

For historical reasons we have program specs using one lot of XML tags that need to be transformed into a different set of tags for inclusion in our documentation. I could hand code each, but some are very large and they will change over time (updates, etc).

I need to create an XSLT file that tests elements and their attributes to determine how to display them in the documentation. How can I test and then output the test result to a new template which I can then call ? I need these to be separate as each program spec will be formatted slightly differently. Is this possible or is there a better way of doing it?



Link to post
Share on other sites


apologies for the ignorance, but I am pretty new to this. So 1. what does the above mean, and 2. how?


PS. I can currently do the test:

<xsl:template match="foobar">
<xsl:when attribute="@attr='true'">
<xsl:call-template name="this_version" />
<xsl:call-template name="other_version" />


My problem is instead of having the call here, I need it where I can format it to display properly. My problem now is how to call when I am formatting and/or what to do here instead of call. Can I save it to a new template which I can call later when I need it? i.e.

<h2>Mt program spec</h2> <dl>

<dt><xsl:call-template name="other_version"/></dt>

<dd><xsl:call-template name="rest_of_spec"/></dd>


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.

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.

  • Create New...