ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error

[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Complete newbie stupid question

Subject: Re: Complete newbie stupid question
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2002 19:20:47 +0100
spell.xml free download
Hi Sandra,

> Hi, I'm new to the list, to XML, to XSL, XSLT and pretty much
> everything related.

Welcome!

> I am trying to do what seems like a simple operation. I just want a
> stylesheet that calls a template in which nested templates specify
> formatting for specific nodes. Seems simple. Seemed simple for the
> first 3 days I tried to make it work. I am now a blithering idiot
> who can hardly spell XML. Can someone please refer me to a good
> source that can help me sort this out? Or better yet, show me an
> example?

You sound like you're in the target audience for my book "Beginning
XSLT", which actually introduces you to the important bits of XML as
well as XSLT. Available from all good booksellers, as they say...

> I have been attempting the following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> xmlns:fo="http://www.w3.org/1999/XSL/Format">

If you're creating HTML, there's no need to include the XSL-FO
namespace.

>     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"/>

This isn't doing anything, so you can safely leave it out.

>     <xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes"/>
>
>     <xsl:template match= "/">
>     </xsl:template>       

This will cause a problem. You're telling the processor that whenever
it's asked to process the root node of a document, do nothing.
Unfortunately, when you run a transformation, the entire result of the
transformation is the result of transforming the root node of the
source document. So if you have a template like this in your
stylesheet, you're guaranteed not to get any output. Either remove
this template or replace it with something that says "when you're told
to process the root node, process its children":

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

This is the template that's built-in for processing the root node, so
if you don't have a template that matches the root node, this is the
one that will be used anyway.

>         <xsl:template match="Head1">
>                 <html>
>                     <font face="Arial" color="black" size="24" 
> style="bold"/>
>                     <br/>
>                 </html>
>         </xsl:template>
> <xsl:apply-templates/>
> </xsl:template>

Erm... I don't think that's well-formed XML -- you seem to have a
stray xsl:template end tag hanging around.

What you meant is:

<xsl:template match="Head1">
  <html>
    <font face="Arial" color="black" size="24" style="bold" />
    <br />
    <xsl:apply-templates />
  </html>
</xsl:template>

or something along those lines (the font element won't have any
effect, I think, since it's empty, so you may as well delete it).

The important thing is that the instruction xsl:apply-templates goes
at the place in the template where you want the result of processing
the result of the document to be inserted. So in this case, if you
want the result of processing the children of the Head1 element to be
put inside the html element, then that's where you need to put the
xsl:apply-templates instruction.

All the templates themselves go at the top level of the stylesheet,
all at the same level. You don't have templates nested inside other
templates. The xsl:apply-templates indicates where the result of
processing should go; the template definitions state what to do when
the processor gets to a particular kind of element.

Have another go and feel free to post here again if you're not getting
what you want. Supplying the source XML that you're processing and a
sample result that you want to get helps as well.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.