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

Re: <xsl:copy-of> question

Subject: Re: <xsl:copy-of> question
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Mon, 22 Jan 2007 11:18:44 -0600
Re:  <xsl:copy-of> question
Hi:

I do have a template match for <para> in my style
sheet.

Why then does it throw this error? This is what is
puzzling me.


As the processor works its way down your input tree, it hits the a element. When it applies the template for the a element, it finds an instruction to copy the child nodes, so it does. Unfortunately, that puts a para element in the result tree.


Since you have a template to match para elements, you need only change

<xsl:copy-of select="node()"/>

to

<xsl:apply-templates/>

Of course, you'll also need templates to handle any other element that can appear within an a element.

Jay Bryant
Bryant Communication Services

--- Jay Bryant <jay@xxxxxxxxxxxx> wrote:

> Hi:
>
> I have a question about <xsl:copy-of>
>
> I have am xml input file:
>
> <a>
> <para>Test</para>
> </a>
>
> My xslt:
>
> <xsl:template match="a">
> <xsl:copy-of select="node()"/>
> </xsl:template>
>
> I am using renderx XEP as the processor, and when
Igenerate the PDF I
> get an error message saying
>
> "Element 'para' belonging to the anonymous
namespace cannot occur in
> an XSL-FO document outside
'instream-foreign-object' elements."
>
> Can you tell me what this means?

It means that para is not one of the elements
supported by FO. The copy-of
statement is copying the para element to the output,
and XEP doesn't
recognize it as valid FO (because it isn't).

You should write a template to handle the para
element, too. For example:

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

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

Now the contents of your para appear in an FO block
element. Assuming you
don't have similar problems elsewhere and that you
have declared the FO
namespace in an appropriate place, those two
templates should solve the
problem.

Jay Bryant
Bryant Communication Services






____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

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.