Re: Using XSL to include non-XML data?
Depending on the amount of data, and Xalan's support for Java extensions, there are other ways of doing this that you might consider. One is to follow John Smirl's example from earlier today in which he shows how to use a Java extension to insert a running total in a document; your problem is structurally similar. The other is to consider turning your Java application's matter into an XML file which could be included in the XSL script using the document() function. This might be impractical if you are dealing with many thousands of entries---you'd probably have to test it to find out. Basically, document() takes a URI which means that you can 'open' a servlet or CGI script which will return the XML. If you can train your Java app to write XML, or wrap its output, you'd be able to index into it easily. Steve Thomas E Enebo wrote: > > I am having a hard time trying to figure out how to ask this question. > Here is a shot at it. I have a list of n text elements in a Java > application. I also have an XML document that has a list of n > sub-elements. I want to write an XSL rule so that the i'th element in > the XML document will be rendered using an XSL rule that will put the > text of the i'th element from the java application as output. Is this > possible? Or should I be looking at this problem in a different way? > > The only two things that strike me are: > > 1. Running the XML data through two stylesheets. The first stylesheet > will generate a second stylesheet that creates n template rules for each > XML subelement with a xsl:param statement and a variable reference. When > the data is rendered a second time, then it will grab the params from the > java application and substitute the variable references. This idea scares > me. > > 2. Create an extension that will do this. An example could be: > <my_extension:insert name="sub_element" value="position()"/> > I am not even sure if this is possible (I am using Xalan). > > -Tom > > -- > +--------http://www.tc.umn.edu/~enebo --------+-mailto:enebo@xxxxxxxxxx -+ > | Thomas E Enebo, Friend of the University | ???????????????????????? | > | Phone: (612) 237-4607 Fax: (???) ???-???? | ???????????????????????? | > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list -- ---------------------------------------------------------------------- Steve Tinney Babylonian Section * University of Pennsylvania Museum stinney@xxxxxxxxxxxxx Phila, PA. 215-898-4047 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format