Re: [xsl] Searching in Sub-children from an Array

Subject: Re: [xsl] Searching in Sub-children from an Array
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Tue, 12 Dec 2006 21:07:15 +0100 (CET)
Houman Khorasani wrote:

  Hi

> Just out of curiosity; do you have a simple example how this
> should work as meta data?  Sounds interesting...

  I'm not sure what you mean.  Do you want a meta-stylesheet sample? 
The principle is verry simple: you have an XML document (looking alike
XSLT or not) and your stylesheet transform it itself in a stylesheet. 
So a generated stylesheet, that can be in turn used to transform other
XML input.

  I think it was the subject of the Mike's talk at XML 2006.  By the
way Mike, do you plan to make some paper available from your talk?

  Here is a simple example, not verry usefull, but giving the idea:

(drkm)[27] ~/xslt/tests$ cat meta-stylesheet.xsl
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:x_="http://www.w3.org/1999/XSL/TransformAlias";
    version="2.0">

  <xsl:namespace-alias
      stylesheet-prefix="x_"
      result-prefix="xsl"/>

  <xsl:output indent="yes"/>

  <xsl:template match="/">
    <x_:stylesheet version="2.0">
      <x_:template match="/">
        <html>
          <head>
            <title>...</title>
          </head>
          <body>
            <xsl:apply-templates select="page/para"/>
          </body>
        </html>
      </x_:template>
    </x_:stylesheet>
  </xsl:template>

  <xsl:template match="para">
    <x_:for-each select="{ @select }">
      <p>
        <x_:value-of select="."/>
      </p>
    </x_:for-each>
  </xsl:template>

</xsl:stylesheet>

(drkm)[28] ~/xslt/tests$ cat meta-stylesheet.xml
<page>
  <para select="any XPath expression selecting nodes"/>
</page>

(drkm)[29] ~/xslt/tests$ saxon meta-stylesheet.xml \
                               meta-stylesheet.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0">
   <xsl:template match="/">
      <html>
         <head>
            <title>...</title>
         </head>
         <body>
            <xsl:for-each select="any XPath expression selecting
nodes">
               <p>
                  <xsl:value-of select="."/>
               </p>
            </xsl:for-each>
         </body>
      </html>
   </xsl:template>
</xsl:stylesheet>

(drkm)[30] ~/xslt/tests$

  Regards,

--drkm






















	

	
		
___________________________________________________________________________ 
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions ! 
Profitez des connaissances, des opinions et des expiriences des internautes sur Yahoo! Questions/Riponses 
http://fr.answers.yahoo.com

Current Thread