insert data param into xml from external file
I am knocking up a simple content management system that will manage the text in an existing multi-language web application.
Each screen of the main application has a corresponding XML file which contains all the text to be displayed on that screen, and there is a seperate file for each language.
The content file is loaded by the XSLT stylsheet which produces the screen:
<xsl:param name="content.xml" select="document(concat('../xml/',$lang,'/filename.xml'))" />
Within the xml file there are a number of different elements for headings, labels, etc, which only contain plain text, which can be manipluated by the user of the CMS using text inputs as normal.
However, The 'paragraph' nodes contain HTML, which is produced by a WISIWIG editor, so that the user can control the fomatting.
The files look something like this
<Heading id="h1" content="Welcome"/>
<Label id="l1" content="Your Name"/>
<p>Welcome to the system, please enter your <b>name</b> below</p>
At the moment the paragraphs are displayed on the application screen by using xsl:copy-of.
So far so good. Now comes the tricky bit...
I need to be able to insert a piece of data from the application xml (the xml document which the xslt is transforming) into a point within the paragraph xml.
for example, if I were to define this paragraph in the xml file:
<p>You have <num_attempts/> attempts left to get it right</p>
How can I display that paragraph on the screen with <num_attempts/> replaced with a figure from the application xml, only by using XSLT?
Feel free to suggest other ways in which i can do this, but the application xslt has to load the content from a static xml file.