Jump to content

create template based on test results


Sparkie

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

Hi,

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:choose>
<xsl:when attribute="@attr='true'">
<xsl:call-template name="this_version" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="other_version" />
</xsl:otherwise>
</xsl:choose>

</xsl:template>

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>

</dl>

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...