Sparkie Posted September 26, 2013 Share Posted September 26, 2013 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 More sharing options...
Martin Honnen Posted September 26, 2013 Share Posted September 26, 2013 It sounds a bit as if you want to define a schema for your class of XML documents and then validate XML instance documents with a validating parser against the schema. Link to comment Share on other sites More sharing options...
Sparkie Posted September 27, 2013 Author Share Posted September 27, 2013 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 More sharing options...
Sparkie Posted October 2, 2013 Author Share Posted October 2, 2013 OK, I now have a fully functioning XSLT that transforms the 1st lot of XML into strings of plain text. Does anyone know how I can now transform that plain text into pretty XML (for inclusion into the output PDF)? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now