Subject: Recursively applying XSL stylesheets to facilitate 'normalizing' data From: "Kent Fitch" <kent.fitch@xxxxxxxxxxxx> Date: Wed, 18 Nov 1998 09:40:59 +1100 |
We are building XML structures which we hope to render into HTML using XSL and maybe some DOM programming. An issue has arisen about how to best cope with a need to 'normalize' data (ie, separate out common fields) and still make it easy to process using XSL. For example, imagine contact information is separated out to a separate place and referenced from some XML like this: <project> <title>Electro-Polymer Research</title> <contactRef staffId=fred type=manager> <contactRef staffId=bill type=publicity> </project> <project> <title>Prostate Cancer Diagnosis</title> <contactRef staffId=jane type=manager> <contactRef staffId=bill type=publicity> </project> Contact information is held in a separate place (file, database...) and the key to that information is the value staffId as used above: <staff id=bill> <forenames>William</fornames> <surname>Smith</surname> <phone> ... <fax> ... <email> ... <mobile>... etc </staff> We want to 'expand' the reference to 'bill', 'fred' or 'jane' whilst processing the project document. We experimented using the new IE5 beta XML/XSL tools as follows: 1) XSL stylesheet comes across the contactRef and using <xsl:eval> passes it to a script 2) the script looks at the attributes and using them locates the fragment of contact information 3) the script then creates an Microsoft.XMLDOM object, passes it this contact information and invokes another stylesheet on it. Step 3 fails giving the error "Automation server can't create object". Other approaches we have thought of are: a) use the DOM to find all contactRef nodes and replace them with the relevant contact details in the project tree, and then invoke the XSL stylesheet or b) get the XSL stylesheet to generate a marker in the output HTML (eg "***REPLACE ME WITH STAFFID='bill'***") and then search for these types of strings in the XSL output and replace them by: - finding & loading the referenced contact info - applying a XSL stylesheet to it - using the output to replace the above text. Has anyone else come across this problem and solved it? kent.fitch@xxxxxxxxxxxx CSIRO Canberra Australia XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Advice needed on an XSL v/s DOM, Dave Halls | Thread | RE: XSL Requirements (was: Microsof, Guy_Murphy |
Re: XSL Requirements (was: Microsof, Daniel Glazman | Date | Re: XSL Requirements (was: Microsof, Oren Ben-Kiki |
Month |