Generate missing XML
-
Hi, I am using an XSL file to format a document for display on my website. A content block has a title, and contains HTML content. The references section always appears at the bottom of the rendered document (regardless of its location within the XML file). ... ... In the XSL I want to create a contents for the document. I have managed to get the content sections listed in the contents. But I find myself duplicating a large chunk of XSL just to add the references section to the contents. Is there a way to do something along the lines of the following? concatenate ?? Get list of content nodes "/mydoc/content" ?? with ... so that I can: and also: Many thanks, Lea Hayes
-
Hi, I am using an XSL file to format a document for display on my website. A content block has a title, and contains HTML content. The references section always appears at the bottom of the rendered document (regardless of its location within the XML file). ... ... In the XSL I want to create a contents for the document. I have managed to get the content sections listed in the contents. But I find myself duplicating a large chunk of XSL just to add the references section to the contents. Is there a way to do something along the lines of the following? concatenate ?? Get list of content nodes "/mydoc/content" ?? with ... so that I can: and also: Many thanks, Lea Hayes
It's probably easy in XSLT 2, but if you're using XSLT 1 like most of us who are relying on Microsoft tools, avoiding duplicated xsl code ist hard. Using a workaround pattern I've sometimes applied in such cases it would look like this: Contents References This is not nice, and can be further refined, but the only way I know to avoid duplicating the logic contained in the for-each statement. I don't have the patience right now to adjust the tabs and spaces which don't look right in the preview. And please be aware that I just copied and pasted it from some old stylesheets of mine and your fragments and have not tested it. There may be syntax errors, but I'm sure you get the gist. And if any one points out a better pattern, I'll add my thanks to yours.
-
It's probably easy in XSLT 2, but if you're using XSLT 1 like most of us who are relying on Microsoft tools, avoiding duplicated xsl code ist hard. Using a workaround pattern I've sometimes applied in such cases it would look like this: Contents References This is not nice, and can be further refined, but the only way I know to avoid duplicating the logic contained in the for-each statement. I don't have the patience right now to adjust the tabs and spaces which don't look right in the preview. And please be aware that I just copied and pasted it from some old stylesheets of mine and your fragments and have not tested it. There may be syntax errors, but I'm sure you get the gist. And if any one points out a better pattern, I'll add my thanks to yours.