RE: [xsl] XSLT template from XSLT + XML

Subject: RE: [xsl] XSLT template from XSLT + XML
From: "James Fuller" <james.fuller@xxxxxxxxxx>
Date: Mon, 30 Sep 2002 21:04:10 +0100
> The first two worked fine, I did them pretty much by hand, there
> weren't too
> many templates to create via xsl:element name="xsl:template".

you know that you can literally output elements, and also use xslt shorthand

for example

xml snippet

<link ref="http://www.test.com";>
here is my link
</link>

xsl snippet

<xsl:template match="/">

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

</xsl:template>

note that this will 'literally' output the <a/> element, no need for the
verbosity of xsl:element, in addition notice that the curly brackets will
output the value of whatever element, attribute, or var/param you supply.

> The third file that I am sort of stuck on is not really all that special,
> but its really much more complex in terms of templates than the other two.
> There must be 20 templates with very complicated matches, and the
> content of
> the templates are pretty tricky.  I am just afraid to do create a template
> for this template by hand.  Too many places for me to screw it up.

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.

usually when you are doing mental gymnastics with the styling and
presentation of your data, its because your data is in a form that is
resisting the application of simple techniques.

> Reading this over, its difficult to accurately convey what I'm
> trying to do,
> much less the why.  I guess what I'm wondering is, can I create an xsl
> template (a) to read in one xsl template (b) and output a template (c),
> which when combined with an xml file (x) containing some options, output a
> template (d) very similar in structure to template b.  Then I can tweak
> template c to make use of the options in file x.  Whew.

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

gl, jim fuller


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


Current Thread