Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2012, 06:34 AM
Registered User
 
Join Date: Sep 2011
Posts: 6
Thanks: 4
Thanked 0 Times in 0 Posts
Default Embedding SVG in XSLT (XSL-FO)

Hi there Gurus!

I wonder if you can help me out here...

I have a XSL-FO document that describes how my document should be rendered when printing it to PDF format. I have a <fo:block> elemnt with some text that i want to rotate. Now, i know that this is achievable using <reference-orientation>, but in my case it wont do, because my FOP version does not support this element. I found a solution in WEB, that shows how i can do the rotation using SVG. But the problem is that when i run my app(written in C#) i get error that says that some SVG elements are not supportable. I think that it should somehow be related with my declaration of the SVG in XSL-FO.
Code:
Code:
<fo:block>
      <fo:instream-foreign-object>
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25pt" height="25pt">
          <g x="5px" y="5px" transform="rotate(45)" style="stroke:none; fill:#000000;">Text</g>
        </svg>
      </fo:instream-foreign-object>
    </fo:block>
and the error i get is:
Code:
Unsupported element encountered: svg (Namespace: http://www.w3.org/2000/svg). Source context: Unknown source

Expected XSL-FO (root, page-sequence, etc.), SVG (svg, rect, etc.) or elements from anothersupported language.

Unsupported element encountered: g (Namespace: http://www.w3.org/2000/svg). Source context: Unknown source
Anybody got an idea what could be wrong?!?

Thanks in advance.

BR,
Transformer
 
Old February 13th, 2012, 06:37 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

As far as I know, you are not allowed to put plain text into an SVG "g" element, you need to put some allowed element in there, like "text" or "tspan".
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog

Last edited by Martin Honnen; February 13th, 2012 at 06:58 AM.. Reason: adding link
The Following User Says Thank You to Martin Honnen For This Useful Post:
Transformer (February 13th, 2012)
 
Old February 13th, 2012, 06:56 AM
Registered User
 
Join Date: Sep 2011
Posts: 6
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks for your quick reply, but yeah, i've tried <text> before with no luck...

BR
 
Old February 13th, 2012, 07:01 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Sounds like an issue with the particular XSL-FO processor you are using. I would recommend checking with them (and you don't mention what processor/library you are using - C# does not have a built in one).

Sam
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
The Following User Says Thank You to samjudson For This Useful Post:
Transformer (February 13th, 2012)
 
Old February 13th, 2012, 07:02 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I think you might want to look for a forum dedicated to the FOP processor you use to find out whether it supports SVG at all and if so how you use it.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old February 13th, 2012, 07:14 AM
Registered User
 
Join Date: Sep 2011
Posts: 6
Thanks: 4
Thanked 0 Times in 0 Posts
Default

The library i use is nFop and vjslib.

Thanks guys anyway. I'll keep on searching...

BR,
Transformer.
 
Old February 13th, 2012, 07:27 AM
Registered User
 
Join Date: Sep 2011
Posts: 6
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Martin, you were right...
My nFop does not support SVG, well actually it does, but just a little. I shall rethink my project needs.

Thank you guys for trying to help me.

BR,
Transformer.





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to include mathml in xsl fo using xsl transformation [email protected] XSLT 0 July 9th, 2011 07:20 AM
XSLT and XSL-FO blg XSLT 1 April 1st, 2010 11:00 AM
xsl:fo anirudhas XSLT 2 December 29th, 2008 03:42 AM
XML to SVG with XSLT DJAJ XSLT 2 February 15th, 2006 07:26 PM
XSL Yielding HTML With SVG hungerf5 XSLT 3 May 12th, 2005 01:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.