> Ick!
> On the other hand, zillions for permutations of fields as separate schemas
> is also ick.
Exactly. At least this way the client can (potentially) ask for any
arbitrary permutation without having to have a well known identifier for
it, or something even more hideous like dynamic schema URIs:
http://srw.o-r-g.org/schemas/dynamic/ead/eadheader/titlestmt/titleproper[1]
If it was a well known identifier, then that identifier might just as well
be a schema + xpath ... so either 'implementation' is possible.
> This is a big step along the road to mandatory profiling. Few of us will
> implement it...
It could be implemented as many many schemas with the same results
currently, so I don't see that it's any further along the road to
mandatory profiling than we already are.
> Well, that might not be true. Dropping the request into an XSLT transform
> might be easy. I'm already running transforms to provide the requested
> schema anyway.
And sort uses XPath for specifying keys already too. Once you have a DOM
structure for the record, doing things with it is pretty cheap. (Of
course, /creating/ the DOM can be expensive!)
But if you have an XSLT engine, surely you must also have an XPath engine
somewhere in there to process the XSL ?
> So, if you'll give some thought to how this might be easily implemented
> (just exactly what the XSLT boilerplate would look like), I guess I might
> refrain from whining.
My implementation would be something along the lines of:
import xpath
...
try:
recordPath = xpath.compile(request.recordXPath)
except:
diag = SRWDiagnostic(XXX)
diag.details = "Unparsable xpath in request"
raise diag
rec = SRWRecord()
try:
node = recordPath.evaluate(document)
rec.recordXPath = request.recordXPath
rec.recordData = str(node)
except:
diag = SRWDiagnostic(XXX)
diag.details = "XPath not valid for record"
rec.recordData = str(diag)
rec.recordSchema = "http://www.loc.gov/srw/diagnostic/1.0/"
response.records.append(rec)
Without an XPath implementation that's separate from your XSLT engine...
<xsl:stylesheet ... version="1.0">
<!-- Wonderful library: http://xsltsl.sourceforge.net/ -->
<xsl:include href="../markup.xsl"/>
<xsl:template match="%%%REPLACE%%%" priority="2">
<xsl:call-template name="markup:as-xml">
<xsl:with-param name="nodes" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template match="*" priority="1">
<!-- Eat unwanted data -->
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
(No guarantees the above will work, but I think it should...)
Rob
--
,'/:. Rob Sanderson ([log in to unmask])
,'-/::::. http://www.o-r-g.org/~azaroth/
,'--/::(@)::. Special Collections and Archives, extension 3142
,'---/::::::::::. Nebmedes: telnet: nebmedes.o-r-g.org 7777
____/:::::::::::::. WWW: http://nebmedes.o-r-g.org:8000/
I L L U M I N A T I
|