xsl-list
[Top] [All Lists]

XSLT template from XSLT + XML

2002-09-30 16:55:46
From: "Michael Semcheski" <mhs(_at_)aylix(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: Re: [xsl] XSLT template from XSLT + XML
Date: Mon, 30 Sep 2002 18:38:43 -0400

<a href="{(_at_)ref}"><xsl:value-of select="link"/></a>

in addition notice that the curly brackets will
output the value of whatever element, attribute, or var/param you supply.

Thats a trick I did not know about before, thanks.

is it possible that instead of your styling that your data needs to go
through a few stages of transformation...always play around with your data
first, then style later.

Well, in this case, it was necessary.  I needed an automated way to create
applications built around xslt.  The xslt's were generally similar, but
needed a few elements to be different, such as relative paths, etc.

there is no reason to autogenerate xslt code using xslt, xslt is
xml....and
can be manipulated just as much as any xml file can be with XSLT...I
suspect
the problem you maybe having is how to 'chain' these transforms together,
in
other words how do you take the output of one transformation and supply it
as the input to another....you have a few options;

- control your processing with script, in the case of MSXML, u could use
javascript to chain a bunch of transforms together

- post an example snippet of xml / xsl maybe we can help

Just for the sake of anyone who might have the same problem in the future,
I'm including a chunk at the bottom.  Suffice it to say, Jeni's suggestion
to use xsl:namespace made it very easy to create the templates and nodes
that were required.  The only thing I was not sure about was what to put in
the xsl:stylesheet line for "axsl" (the style-sheet prefix that became xsl)

By the way, I'm surprised at how many auto-responders are on the mailing
list.  If you're out on vacation, good for you.  I am not.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:rs="urn:schemas-microsoft-com:rowset"
   xmlns:z="#RowsetSchema"
   xmlns:axsl="futurexsl">
   <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl" />
   <xsl:template match="/compile-options">
       <axsl:template match="/xml/rs:data/zbundle">
           <tr>
               <axsl:if test="z:row[(_at_)Suppress_Seperator='False']">
                   <td>
                       <xsl:attribute name="src"><xsl:value-of
select="design/image-directory"/>images/background.jpg</xsl:attribute></img>
                   </td>
               </axsl:if>
               <axsl:if test="z:row[(_at_)Suppress_Seperator='True']">
                   <td valign="top" colspan="2"/>
               </axsl:if>
           </tr>
           <tr>
               <axsl:if
test="not(boolean(z:row[(_at_)QNumber]))"><td>&#160;</td></axsl:if>
               <axsl:if
test="boolean(z:row[(_at_)QNumber])"><td><img><axsl:attribute
name="src"><xsl:value-of select="design/image-directory"/><axsl:value-of
select="z:row/@QNumber"/>.jpg</axsl:attribute></img></td></axsl:if>
               <td>
                   <table>
                       <axsl:apply-templates select="z:row"/>
                   </table>
               </td>
           </tr>
       </axsl:template>
   </xsl:template>
</xsl:stylesheet>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>