Re: [xml] Re: libxslt question



Hi

    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
<xsl:document>.


regards
        Lucas Brasilino

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

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="html"/>

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

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


--

[]'s
Lucas Brasilino
brasilino recife pe gov br
http://www.recife.pe.gov.br
Emprel -        Empresa Municipal de Informatica (pt_BR)
                Municipal Computing Enterprise (en_US)
Recife - Pernambuco - Brasil
Fone: +55-81-34167078




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