Subject: RE: Use of document() and an English description please! From: "Vun Kannon, David" <dvunkannon@xxxxxxxx> Date: Wed, 2 Feb 2000 12:38:26 -0500 |
Suppose you had a situation where the XML vocabulary supported an "import" mechanism, and of course imported node sets could themselves import other node sets recursively, on and on. XSchema does this. Here is a stylesheet that slightly modifies the identity transform. The additional piece brings in the imported nodes so that you can see in the result document the original source document plus all the imported nodes. <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"> <template match="/"> <apply-templates/> </template> <template match="@*|comment()|text()|processing-instruction()"> <copy> <apply-templates select="@*|comment()|text()|processing-instruction()"/> </copy> </template> <template match="*"> <copy> <apply-templates select="@*"/> <!-- now bring any imported nodes --> <if test="self::import/@uri"> <apply-templates select="document(@uri)"/> </if> <apply-templates select="*|comment()|text()|processing-instruction()"/> </copy> </template> </stylesheet> Here are a set of faux XSchema documents that refer to each other: fabulous.xsd: <schema name="Fabulous"> <import uri="kpmg.xsd"/> <element name="DomainName"/> </schema> kpmg.xsd: <schema name="KPMG Media"> <import uri="core.xsd"/> <element name="BrandEquity"/> </schema> core.xsd: <schema name="Core"> <element name="BalanceSheet"/> </schema> Run the stylesheet against the first schema document given above and you should get <?xml version="1.0" encoding="utf-8"?> <schema name="Fabulous"> <import uri="kpmg.xsd"><schema name="KPMG Media"> <import uri="core.xsd"><schema name="AICPA Core"> <element name="BalanceSheet"/> </schema></import> <element name="BrandEquity"/> </schema></import> <element name="DomainName"/> </schema> Actual XSchema document processing might replace the import element with the imported nodes (in order to keep it a valid schema), my point is not be explicit on that kind of issue. I just want to show how I've used document(). Cheers, David vun Kannon Manager, Financial Services KPMG Consulting LLC -----Original Message----- From: Dan Vint [mailto:dvint@xxxxxxxx] Sent: Wednesday, February 02, 2000 9:47 AM To: xsl-list@xxxxxxxxxxxxxxxx Subject: Use of document() and an English description please! I've read several postings about using document() to process additional files, would someone post a template that does this please. Also, in reading the description of document () in the standard I'm lost and not even sure that I agree that the any of the combinations do this. Would some one care to take a stab at explaining the various combinations that document() can be used in, or at least the ones that you have verified work and what they do? ..dan At 01:03 PM 2/2/00 +0000, you wrote: > >> I do have XML files that specify the filenames and paths of all the >> documents in a specific subdirectory. Could I somehow read such a >> filenames-file and call the document function for each of the >> files listed, and then extract the information I want from each >> document? > >Mike brown showed how you can read such a file. Note that you don't have >to manually update your index file if you can configure your server. >If you put a http URL to a directory in the document() function XSL will >be passed back whatever the server sends. Normally this is something >like an index.html file from that directory but you can set up the >server to run a perl (or whatever) script over the directory and >send back a directory listing in XML syntax. > >David > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list --------------------------------------------------------------------------- Danny Vint http://www.dvint.com Author: SGML at Work http://www.slip.net/~dvint/pubs/sgmlatwork.shtml mailto:dvint@xxxxxxxx Calian Voice:804-975-3482 mailto:d.vint@xxxxxxxxxx Charlottesville, VA Office http://www.calian.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list ***************************************************************************** The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this email are subject to the terms and conditions expressed in the governing KPMG client engagement letter. ***************************************************************************** XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: XSL and XML in one file, Kay Michael | Thread | Multiple if, tmmet tvp |
Re: recursively including xml-files, David Carlisle | Date | Multiple if, tmmet tvp |
Month |