[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using XSL to create interactive web page from XML

Subject: Re: Using XSL to create interactive web page from XML
From: Eliot Kimber <ekimber@xxxxxxxxxxxx>
Date: Sat, 01 Dec 2007 08:05:24 -0600
Re:  Using XSL to create interactive web page from XML
Furst, Tom wrote:
Using XSLT 2.0 is not required.  But if it will make resolving this
problem any easier to accomplish, or for me to understand, I'm all
for it.

XSLT 2 always makes whatever you're doing easier to accomplish and/or understand.


Looking at the code you posted, I would first recommend refactoring your single template into multiple templates, one for each element type in the document hierarchy, so that the HTML generated for each element type is bound to that element type's template. That will make it easier to see what's going on and focus on specific processing details.

In addition, rather than using for-each to iterate over the solutions, you should have a template for solution and use apply templates.

For the linking, you will need to create a template or XSLT function (2.0 to the rescue) that resolves the corrective-action-refs to their targets (e.g., by matching on the ID attributes. You can then apply templates to the resolved corrective actions in the context of iframe you're generating (I don't know exactly how the corrective actions would be put into the iframe).

For doing this type of address resolution, I find it easiest to use a key table to hold all the potential targets and then use that table to resolve the references, e.g.,:

<xsl:key name="corrective-action-by-id" select="corrective-action" use="@id"/>

Then in your template where you want to resolve a reference you would do something like this:

<xsl:variable name="refid" select="@idref" as="xs:string"/>
<xsl:variable name="target-ca"
  select="key('corrective-action-by-id', $refid)
/>
<!-- put error checking here -->
<xsl:apply-templates select="target-ca"/>

For output generation, one normally uses generate-id() to generate unique target IDs for generated elements.

Cheers,

Eliot
--
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 610.631.6770
www.reallysi.com
www.rsuitecms.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.