sungod wrote:
> 
> On Sun, Jan 14, 2001 at 05:52:58PM +0000, cutlass ([EMAIL PROTECTED]) wrote:
> > sungod wrote:
> > > <xsl:stylesheet
> > >         version="1.0"
> > >         xsl:version="1.0"
> > >         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > >
> > >         <xsl:output method="xml" indent="yes"/>
> > >
> > >         <xsl:template match="document('200101111200.xml')/article">
> > >                 <xsl:template select="date"/>
> > >                 <xsl:template select="title"/>
> > >                 <xsl:template select="summary"/>
> > >         </xsl:template>
> > > </xsl:stylesheet>
> >
> > u are trying to 'match' instead of 'select'  ( same error code for
> > earlier versions of sabcmd re: document() )

1) xsl:version attribute is incorrect; just use the 'version' one.
2) match="document()" is invalid XSLT; only id() and key() may be used
in
    match
3) select cannot be used on xsl:template; only on *xsl:apply-templates*
which    I think is what you mean
4) xsl:template cannot be nested, it can only be used at the top-level

> Well, that IS correct syntax, according to the zvon.org XSLT reference, but > you 
>have drawn attention to a mistake on my part. The date, title, and
> summary selections were supposed to be <xsl:copy-of> elements rather than
> <xsl:template> elements. That didn't fix the crash and core-dump, though.

zvon is terrific, but they are not the reference for XSLT correctness:
the XSLT spec is (http://www.w3.org/TR/xslt; note that there is already
a draft XSLT 1.1 which makes a few things easier like multiple output
destinations and repeated processing of nodes selected within
variables).
 
> > use  <xsl:copy-of select='document("somexmldocument.xml")'/>
> >
> > and use this method to create a sourcexml of all your children, then
> > apply another xsl transformation for styling to that 'big; file
> 
> I thought about doing this, but there's a drawback here: when I get this technique 
>working with my news site, I want to apply it also to a library of e-books I'm making 
>from texts I get at Project Gutenberg. These books can be several hundred kilobytes 
>in length, and I really don't want to subject my system to the overhead incurred in 
>concatenating all of them together just to get title and author information from them.
> 
> Instead, I need to use an element that does the same operation as <xsl:copy-of> but 
>which also applies the transformation instructions inside that element. I thought 
><xsl:template> would do this, and again, my question is unanswered: is Sablotron 
>SUPPOSED to do this, or am I misunderstanding?


It sounds like you want something like:

        <xsl:for-each select="document('somedoc.xml')">
          <xsl:apply-templates select="/metadata/author"/>
        </xsl:for-each>

But maybe you should be thinking of ripping out the often-needed
metadata and caching it in a separate doc with xlinks pointing to the
document the metadata refers to?
 
> I apologize if my asking for XSLT help is off-topic here, but since it is >resulting 
>in a Sablotron crash, hopefully it can be used to clean up a bug >or two.

True, but at this stage of the game it seems only fair to me to try to
feed Sablotron slightly less arbitrary input (I don't mean that Sab
shouldn't have to deal with incorrect input, only that I would prefer
that more effort go into implementing missing features right now).

A good thing to do is to use several XSL processors as a check on your
input. Michael Kay's Saxon is excellent at both conformance and
error-checking/reporting.

 Steve

Reply via email to