Loading ...
Sorry, an error occurred while loading the content.

Is it possible to look inside fo:external-graphics (svgz) using XSL-FO?

Expand Messages
  • odekij61
    Hello, We have been using Adobe Illustrator 10.0.3 to create our SVGZ graphics, for about a year. We found out that it does not save the width and height
    Message 1 of 5 , Mar 9, 2004
    • 0 Attachment
      Hello,
      We have been using Adobe Illustrator 10.0.3 to create our SVGZ
      graphics, for about a year. We found out that it does not save the
      width and height correctly. This is noticeable when you try printing
      a 3"x3" box ... it prints out of Internet Explorer 6 as a 2.25"x2.25"
      box.

      I basically want to do something like this:

      If (Illustrator SVGZ or Illustrator SVG)<-(this is short pseudocode)
      then
      <fo:external-graphic src="{@source}" content-width="133%"
      content-height="133%" />
      else
      <fo:external-graphic src="{@source}" />
      End if

      This will allow us to use Corel Designer 10 SVG graphics along with
      Adobe Illustrator's.

      If it is possible to check for an adobe namespace I can assume the SVG
      is created with Adobe Illustrator.

      Is there a way to do this in XSL-FO possibly using embedded
      javascript?

      Thanks a ton!

      Jeremy Odekirk
    • G. Ken Holman
      ... Yes, the following can be checked in XSLT, but not in XSL-FO ... assuming you are transforming your various sources into XSL-FO, you will be able to check
      Message 2 of 5 , Mar 9, 2004
      • 0 Attachment
        At 2004-03-09 21:15 +0000, odekij61 wrote:
        >We have been using Adobe Illustrator 10.0.3 to create our SVGZ
        >graphics, for about a year. We found out that it does not save the
        >width and height correctly. This is noticeable when you try printing
        >a 3"x3" box ... it prints out of Internet Explorer 6 as a 2.25"x2.25"
        >box.
        >
        >I basically want to do something like this:

        Yes, the following can be checked in XSLT, but not in XSL-FO ... assuming
        you are transforming your various sources into XSL-FO, you will be able to
        check the namespaces.

        >If (Illustrator SVGZ or Illustrator SVG)<-(this is short pseudocode)
        >then
        > <fo:external-graphic src="{@source}" content-width="133%"
        >content-height="133%" />
        >else
        > <fo:external-graphic src="{@source}" />
        >End if
        >
        >This will allow us to use Corel Designer 10 SVG graphics along with
        >Adobe Illustrator's.
        >
        >If it is possible to check for an adobe namespace I can assume the SVG
        >is created with Adobe Illustrator.

        At XSLT time, when you are ready to copy the SVG file, use the
        namespace-uri(.) function on the document element of the SVG fragment to
        examine the URI.

        >Is there a way to do this in XSL-FO

        No, XSL-FO doesn't give you this kind of control. You have to choose to
        make one set of attributes or another at the time you create the
        <fo:external-graphic> and you make the choice based on your analysis of the
        namespace URI of the fragment you are merging into your output XSL-FO stream.

        >possibly using embedded javascript?

        There is no role for javascript in an XSL-FO file.

        I hope this helps.

        ............................... Ken

        --
        US XSL training: Washington,DC March 15; San Francisco,CA March 22
        World-wide on-site corporate, government & user group XML training
        G. Ken Holman mailto:gkholman@...
        Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
        Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
        Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
      • odekij61
        Hello, Does this work even if all the SVGZ graphics are external separate files? Have any sample code? Thanks, Jeremy Odekirk ... assuming ... able to ...
        Message 3 of 5 , Mar 10, 2004
        • 0 Attachment
          Hello,
          Does this work even if all the SVGZ graphics are external separate
          files? Have any sample code?

          Thanks,
          Jeremy Odekirk


          --- In XSL-FO@yahoogroups.com, "G. Ken Holman" <gkholman@c...> wrote:
          > At 2004-03-09 21:15 +0000, odekij61 wrote:
          > >We have been using Adobe Illustrator 10.0.3 to create our SVGZ
          > >graphics, for about a year. We found out that it does not save the
          > >width and height correctly. This is noticeable when you try printing
          > >a 3"x3" box ... it prints out of Internet Explorer 6 as a 2.25"x2.25"
          > >box.
          > >
          > >I basically want to do something like this:
          >
          > Yes, the following can be checked in XSLT, but not in XSL-FO ...
          assuming
          > you are transforming your various sources into XSL-FO, you will be
          able to
          > check the namespaces.
          >
          > >If (Illustrator SVGZ or Illustrator SVG)<-(this is short pseudocode)
          > >then
          > > <fo:external-graphic src="{@source}" content-width="133%"
          > >content-height="133%" />
          > >else
          > > <fo:external-graphic src="{@source}" />
          > >End if
          > >
          > >This will allow us to use Corel Designer 10 SVG graphics along with
          > >Adobe Illustrator's.
          > >
          > >If it is possible to check for an adobe namespace I can assume the SVG
          > >is created with Adobe Illustrator.
          >
          > At XSLT time, when you are ready to copy the SVG file, use the
          > namespace-uri(.) function on the document element of the SVG
          fragment to
          > examine the URI.
          >
          > >Is there a way to do this in XSL-FO
          >
          > No, XSL-FO doesn't give you this kind of control. You have to
          choose to
          > make one set of attributes or another at the time you create the
          > <fo:external-graphic> and you make the choice based on your analysis
          of the
          > namespace URI of the fragment you are merging into your output
          XSL-FO stream.
          >
          > >possibly using embedded javascript?
          >
          > There is no role for javascript in an XSL-FO file.
          >
          > I hope this helps.
          >
          > ............................... Ken
          >
          > --
          > US XSL training: Washington,DC March 15; San Francisco,CA March 22
          > World-wide on-site corporate, government & user group XML training
          > G. Ken Holman mailto:gkholman@C...
          > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
          > Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
          > Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
        • G. Ken Holman
          ... Sure ... you are pointing to the file and an SVG file is an XML file so your XSLT processor will be able to open it. ...
          Message 4 of 5 , Mar 10, 2004
          • 0 Attachment
            At 2004-03-10 15:27 +0000, odekij61 wrote:
            >Does this work even if all the SVGZ graphics are external separate
            >files?

            Sure ... you are pointing to the file and an SVG file is an XML file so
            your XSLT processor will be able to open it.

            >Have any sample code?

            <xsl:when test="namespace-uri(document(uri-here)/*)='Adobe-URI-here'">
            <!--do whatever you need for Adobe-->

            What more of a sample do you need? All I'm doing here is opening up the
            URI of the file using XSLT and checking the namespace URI of the document
            element for being a particular string.

            I hope this helps.

            ....................... Ken

            --
            US XSL training: Washington,DC March 15; San Francisco,CA March 22
            World-wide on-site corporate, government & user group XML training
            G. Ken Holman mailto:gkholman@...
            Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
            Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
            Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
          • odekij61
            Hello, I am trying to look for something in the SVG code to see if it was created by Illustrator. (as opposed to Corel Designer) The namespace-uri document
            Message 5 of 5 , Mar 11, 2004
            • 0 Attachment
              Hello,

              I am trying to look for something in the SVG code to see if it was
              created by Illustrator. (as opposed to Corel Designer)
              The namespace-uri document functions appear to keep returning the
              default SVG namespace, no matter what I put, although it might be
              returning all namespaces, but I can't tell from the error message
              that's cut off. I want to look at the svg for
              xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/".

              I think the code should be something like
              <xsl:if
              test="namespace-uri(document(@source)/svg/*)='http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/'">


              ----------------------------------------------
              Here's the beginning of an SVG file for reference:
              <?xml version="1.0" encoding="utf-8"?>
              <!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG
              Version: 3.0.0 Build 77) -->
              <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
              "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
              <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
              <!ENTITY ns_svg "http://www.w3.org/2000/svg">
              <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
              <!ENTITY st0 "enable-background:new ;">
              <!ENTITY st1 "font-family:'Arial-BoldMT';">
              <!ENTITY st2 "fill:#FFFFFF;stroke:#000000;">
              <!ENTITY st3 "font-size:12;">
              ]>
              <svg xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
              xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
              width="217" height="243.795" viewBox="0 0 217 243.795"
              style="overflow:visible;enable-background:new 0 0 217 243.795"
              xml:space="preserve">
              ....
              -----------------------------------------

              Right now I get an error in Antennahouse XSL Formatter. "Error while
              parsing 'file::///c:/abc.svg'. A connection with the server could not
              be established. Error processing resource
              'http://www.w3.org/TR/2001/REC-SVG-20010904..."

              It also appears this will not work at all if I try with an .SVGZ, or
              zipped SVG because it says invalid character.

              Any help is greatly appreciated!

              Thanks,
              Jeremy Odekirk


              --- In XSL-FO@yahoogroups.com, "G. Ken Holman" <gkholman@c...> wrote:
              > At 2004-03-10 15:27 +0000, odekij61 wrote:
              > >Does this work even if all the SVGZ graphics are external separate
              > >files?
              >
              > Sure ... you are pointing to the file and an SVG file is an XML file so
              > your XSLT processor will be able to open it.
              >
              > >Have any sample code?
              >
              > <xsl:when test="namespace-uri(document(uri-here)/*)='Adobe-URI-here'">
              > <!--do whatever you need for Adobe-->
              >
              > What more of a sample do you need? All I'm doing here is opening up
              the
              > URI of the file using XSLT and checking the namespace URI of the
              document
              > element for being a particular string.
              >
              > I hope this helps.
              >
              > ....................... Ken
              >
              > --
              > US XSL training: Washington,DC March 15; San Francisco,CA March 22
              > World-wide on-site corporate, government & user group XML training
              > G. Ken Holman mailto:gkholman@C...
              > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
              > Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
              > Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
            Your message has been successfully submitted and would be delivered to recipients shortly.