Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 24th, 2006, 01:47 PM
Authorized User
Join Date: Oct 2004
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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"/>
    <Item id="p1">
        <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.

<xsl:copy-of select="$content.xml/Paragraphs/Item[@id='p1']"/>

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:

<Item id="p2">
    <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.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
append/insert data to xml file andhiez XML 5 April 18th, 2008 11:13 AM
getting data from XML and insert it into a databas belete XML 3 November 20th, 2007 12:38 PM
Error 'SQL_C_NUMERIC' with param Insert query bnorg MySQL 0 December 16th, 2006 07:30 PM
how to Insert data into external db method Access VBA 5 May 4th, 2005 10:59 AM
Reading from external data file peter_budo C++ Programming 5 December 14th, 2004 03:06 PM

All times are GMT -4. The time now is 01:51 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.