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

integrating xslt and xquery

Subject: integrating xslt and xquery
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Thu, 21 Oct 2004 12:21:52 -0400
citation xml
I'd like to include an xquery script with my stylesheet archive to do the following:

1) take my source document, extract all of the citations from it
2) use that list of citations to create a bibliography collection, where the bibliographic records are in their own directory, with filenames that are the same as the IDs, plus an extension.


So, citation is:

<citation><biblioref linkend="doe99"/></citation>

The record it points to is thus "bib-data/doe99.xml".

3) Insert that bibliography into the document, and then run my stylesheets on it, with a citation-style parameter entered by the user on the commandline.

Below is where I'm at. I'm stuck on

1) how to define the article path to be a variable entered by the user
2) how to define where to grab the mods data (bib-data/{$citation}.xml doesn't work, nor does bib-data/*)
3) how to run the stylesheets (with parameter) on the returned article


Bruce

xquery version "1.0";

declare default element namespace "http://docbook.org/docbook-ng";
declare namespace mods="http://www.loc.gov/mods/v3";
declare namespace xbiblio="http://xbiblio.sourceforge.net";

declare function xbiblio:resolve-references($article as element())
as element()* {
  (: extract citation linkend values from the docbook-ng file :)
    for $citation in distinct-values($article//biblioref/@linkend)
  (: find the corresponding mods record :)
  let $mods := doc("bib-data/*")//mods:mods[@ID = $citation]
    return
      if(empty($mods)) then
        (: not found: stop processing :)
        error(concat("No record found for reference ", $citation))
      else
	$mods
};

let $article := doc("test.xml")/article
return
  <article>
    {$article/*}
  <bibliography>
    <mods:modsCollection>
       {xbiblio:resolve-references($article)}
    </mods:modsCollection>
  </bibliography>
</article>

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.