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

RE: XSLT/FO Newbie Question

Subject: RE: XSLT/FO Newbie Question
From: "Stuart Celarier" <stuart@xxxxxxxxxxx>
Date: Mon, 20 May 2002 09:32:27 -0700
xslt suppress namespace
Scott, you have declared the XML namespace prefix 'xsl' on the document
(root) element, so it is in scope within the <xsl:stylesheet> element.
However you have declared the 'fo' namespace prefix only on the
<fo:root> element within the <xsl:template match="/"> element, so it is
only in scope within that element. To make the 'fo' namespace prefix
visible throughout the stylesheet, move the declaration to the
<xsl:stylesheet> element.

This is basic XML namespace stuff, covered in any XML textbook or
tutorial on the topic, or see the specification [1].

If you want to suppress namespace declarations in the output of an XSLT
transformation, see exclude-result-prefixes at [2].

Cheers,
Stuart

[1] http://www.w3.org/TR/REC-xml-names/
[2] http://www.w3.org/TR/xslt#stylesheet-element

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
Meadows
Sent: Monday, May 20, 2002 09:06
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  XSLT/FO Newbie Question

I'm trying to create a simple XSL-FO document, but the following code
produces a syntax error when I try to view it in IE.

Error: reference to undeclared namespace

The resulting FO document also adds xmlns:fo="" to each of the prefixed
block elements. I'm assuming these problems are one and the same
(something
to do with my fo:block nesting), but I don't know enough about XSLT and
namespaces to understand how to correct it.

Can anybody help me with this one?


----------------------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="xml"/>

        
<xsl:template match="/">

  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    
        <fo:layout-master-set>
            <fo:simple-page-master master-name="II_18">
                <fo:region-body margin-left=".5in" margin-right=".5in"
                margin-top="1in" margin-bottom="1in"/>
            </fo:simple-page-master>
        </fo:layout-master-set>
        
        <fo:page-sequence master-name="II_18">
            <fo:flow flow-name="xsl-region-body">
                
                <xsl:apply-templates/>
                
    
                </fo:flow>
        </fo:page-sequence>
    </fo:root>
    
</xsl:template>


<xsl:template match="chapter">
    <fo:block 
    space-after.optimum="10pt"
    font-weight="bold"
    font-size="12pt"
    text-align="center">
                
        <xsl:value-of select="."/>
                   
    </fo:block>

</xsl:template>

<xsl:template match="title">
    <fo:block 
    space-after.optimum="10pt"
    font-weight="bold"
    font-size="16pt"
    text-align="center">
                
        <xsl:value-of select="."/>
                   
    </fo:block>

</xsl:template>



<xsl:template match="para">

<fo:block
        text-align="left"
        font-size="10px"
        font-family="Helvetica">

    <xsl:value-of select="."/>
    
    </fo:block>

</xsl:template>
    
</xsl:stylesheet>


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


 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.