Re: [xslt] exslt:document and xsltproc



Daniel Veillard wrote:
> On Mon, Nov 20, 2006 at 12:38:51PM +0000, david reid wrote:
>> Given Daniels comments, I'll not pursue this any further.
> 
>   If you had given a minimal example from the start, as indicated,
> it would have been immediately clear what was happening. 
>   You seems frustrated by the fact I pointed this out, I'm sorry 
> but those guidelines are there for a reason, one of them is to
> minimize the overall work needed to keep the project alive. The
> alternative is to loose slowly all the prople who gather knowledge
> on the library, and in the end nobody will answer questions. There
> is far more users eager to get their answer than people with 
> good knowledge of the specs and associated code, we must split the
> workload.

Simplified xsl

test.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version = "1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:exsl="http://exslt.org/common";
                extension-element-prefix="exsl">

  <xsl:output method="xml" indent="yes" encoding="utf-8"/>

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

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

  <xsl:template match="doapFile">
    <xsl:variable name="url" select="concat(@id, '.xml')"/>
    <file><xsl:value-of select="$url"/></file>
    <exsl:document href="{$url}" encoding="UTF-8" indent="yes"
                   omit-xml-declaration="no">
      <testDocument>
        <URL>
          <xsl:value-of select="URL"/>
        </URL>
      </testDocument>
    </exsl:document>
  </xsl:template>

</xsl:stylesheet>

xsltproc -o test.xml test.xsl http://david-reid.com/files.list

produces

<?xml version="1.0" encoding="utf-8"?>
<testCase xmlns:exsl="http://exslt.org/common";>
  <file>forrest.xml</file>
  <exsl:document href="forrest.xml" encoding="UTF-8" indent="yes"
omit-xml-declaration="no">
    <testDocument>
      <URL>http://forrest.apache.org/doap.xml</URL>
    </testDocument>
  </exsl:document>
  <file>jackrabbit.xml</file>
  <exsl:document href="jackrabbit.xml" encoding="UTF-8" indent="yes"
omit-xml-declaration="no">
    <testDocument>
      <URL>http://jackrabbit.apache.org/doap_Jackrabbit.rdf</URL>
    </testDocument>
  </exsl:document>
  ...

What I want is to have forrest.xml, jackarbbit.xml output, while the
underlying XML is saved as test.xml. Possible?

-- 
david

Have you listened to FeatherCast yet?
http://feathercast.org/

Bought the t-shirt?
http://www.cafepress.com/feathercast/


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