xsl-list
[Top] [All Lists]

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

2006-12-12 13:32:42
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






















        

        
                
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--