Re: [xml] Re: libxslt question

On Tue, 2004-03-02 at 10:24, Lucas Brasilino wrote:

    It's a XSLT question, not a libxslt question. Take a look at
<xsl:document> element at XSLT specs.

Thanks. I was looking at an old draft of XSLT (1999) which didn't have 
that element. However, I'm still not sure how to use it.

      Sure... <xsl:document> is not defined in XSLT 1.0.

Which function does the actual writing of these sub-documents? And what

      Just apply stylesheet with xsltApplyStylesheet(). Yes.. is that
easy :) Take a look at John Fleck's libxslt tutorial

happens if the stylesheet tries to place them in directories that do not 
exist, will those then be created? I'm asking because the document names

      Sure it will not create directories, AFAIK. It will raise an
I/O error.

and directories they are places in should in my case be derived from the 
input data.

      No problem. Take a look in this small example. What you have
to do is create output document path/file within href attribute of

      Lucas Brasilino

<?xml version="1.0" ?>
   <foo name="first">
     <text>Foo 1</text>
   <foo name="second">
     <text>Foo 2</text>

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" 
   <xsl:output method="html"/>

   <xsl:template match="/">

   <xsl:template match="foo">
     <xsl:document href="{concat('out',position(),'.html')}">
       <xsl:for-each select="text">
          <title><xsl:value-of select="."/></title>
          <h1><xsl:value-of select="."/></h1>

Are you using xsl:document to create separate output files?  That isn't
what it does.  The xsl:document function imports additional XML files
for processing.  What you want is the (very poorly named) exsl:document
extension function.

Discussion of this belongs on a dedicated XSLT list, or the EXSLT list,
rather than the libxml2 or libxslt lists.

Unless, of course, you want to discuss the actual implementation of
exsl:document in libxslt, in which case the discussion should be taken
to the libxslt mailing list.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]