Connecting Tech Pros Worldwide Help | Site Map

Can we convert xml format to other xml format like (OEBPS)

Newbie
 
Join Date: Nov 2009
Posts: 10
#1: 2 Weeks Ago
hi
i have xml file , i want to transform its format to OEBPS format by PHP, is it possible to transform xml conversion to other xml format ?

Kindly reply me as soon as possible

Thanks
Sachin Sharma
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


if you have an appropriate XSL file, PHP can do the conversion for you.
Newbie
 
Join Date: Nov 2009
Posts: 10
#3: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


thanks for ur reply
can your help me with code how php will do this conversion ?

Thanks
Sachin Shastri
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


PHP 5 has its own XSL processing class, see its documentation.
Newbie
 
Join Date: Nov 2009
Posts: 10
#5: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


thanks
But i am not geting with OEBPS format
Can u help me in that , how we transform in this format

Thanks
Shastri
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#6: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


as I mentioned, you have to write an XSL file for that.
Newbie
 
Join Date: Nov 2009
Posts: 10
#7: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


ok but how xsl convert it into OEBPS format
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#8: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


that depends on what you have, see also this tutorial
Newbie
 
Join Date: Nov 2009
Posts: 10
#9: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


see this link
http://www.idpf.org/oebps/oebps1.2/index.htm
i want to convert my xml into Open eBook Publication Structure Specification Version 1.2 it also a xml type coding

see i want to convert my xml into this format through php

The OEBPS/As You Like It.opf file:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?> <!DOCTYPE package PUBLIC "+//ISBN 0-9673008-1-9//DTD OEB 1.2 Package//EN" "http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd"> <package unique-identifier="Package-ID"> <metadata> <dc-metadata xmlns:dc="http://purl.org/dc/elements/1.0" xmlns:oebpackage="http://openebook.org/namespaces/oeb-package/1.0"> <dc:Identifier id="Package-ID">ebook:guid-6B2DF0030656ED9D8</dc:Identifier> <dc:Title>As You Like It</dc:Title> <dc:Creator role="aut">William Shakespeare</dc:Creator> <dc:Identifier>0-7410-1455-6</dc:Identifier> <dc:Subject></dc:Subject> <dc:Type></dc:Type> <dc:Date event="publication">3/24/2000</dc:Date> <dc:Date event="copyright">1/1/9999</dc:Date> <dc:Identifier scheme="ISBN">0-7410-1455-6</dc:Identifier> <dc:Publisher>Project Gutenberg</dc:Publisher> <dc:Language></dc:Language> </dc-metadata> </metadata> <manifest> <item id="4915" href="book.html" media-type="text/x-oeb1-document"/> <item id="7184" href="images/cover.png" media-type="image/png" /> </manifest> <spine> <itemref idref="4915"/> </spine> </package>
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#10: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


and what is your XML? usually, you have to write xsl files yourself (some IDE’s may provide conversion of one known xml format into another known one)
Newbie
 
Join Date: Nov 2009
Posts: 10
#11: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


1) can we do conversion of xml to xsl by pragmatically in php ?

2) can we do conversion of XSL format to OEBPS format by pragmatically in php ?

Is these are possible or not ?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#12: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


1) I think you misunderstand here. you do xml-to-xml conversion using xsl and php
2) Yes, if you feed PHP with an input xml and an input xsl
Newbie
 
Join Date: Nov 2009
Posts: 10
#13: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


thanks i got ur point
but can we do conversion of XSL format to OEBPS format by pragmatically in php ?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#14: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


why do you want to convert xsl? didn’t you want to convert your xml file?
Newbie
 
Join Date: Nov 2009
Posts: 10
#15: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


yeah i want to convert my xml but how i can get OEBPS format.

according to u first i will convert my xml into xsl
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#16: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


Quote:

Originally Posted by sachinshastri View Post

according to u first i will convert my xml into xsl

I never said that. I said, you’d need an XSL file to do the conversion.

here is a part of my project, using xml conversion.
on line 17 I pass an xml file (name), read from the input object $inSeite_in, via a selfmade wrapper to PHP’s XSLTprocessor class.
on line 18 I do the same with the xsl file name
line 20 triggers the conversion and returns the result xml (in this case xhtml)
Expand|Select|Wrap|Line Numbers
  1.     protected function Transform(
  2.         Seite $inSEITE_in, 
  3.         $sy_par  = '', 
  4.         $f_empty = XSLT_FORCE_RESULT
  5.     ) 
  6.     {
  7.         # set parameter correctly
  8.         $param = ($sy_par === '' and isset($this->ID)) ? $this->ID : $sy_par;
  9.         $mp_param = ($inSEITE_in->PAR_NAME) ? $inSEITE_in->getValue('PAR_ARRAY', $param) : array();
  10.  
  11.         try 
  12.         {    # load XSLT
  13.             $inXSLT_process = XSLTransform::getInstance();
  14.             # set parameter
  15.             $inXSLT_process->emptyResult = (bool) $f_empty;
  16.             # load files
  17.             $inXSLT_process->loadXML($inSEITE_in->XML);
  18.             $inXSLT_process->loadXSL($inSEITE_in->XSL);
  19.             # processing
  20.             $data = $inXSLT_process->Process($mp_param);
  21.         }
  22.         catch (ProcException $pe)
  23.         {
  24.             ErrorLog::add($pe, __CLASS__);
  25.             trigger_error(500, E_USER_ERROR);
  26.             return '<!-- Parser Error -->'; // ???
  27.         }
  28.         return $data;
  29.     }
  30.  
Newbie
 
Join Date: Nov 2009
Posts: 10
#17: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


thanks for ur valuable support
i try with it but i am yet confused with OEBPS format.

Thanks
Shastri
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#18: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


basicly you have to find out which xml element of your xml corresponds to which xml element of oebps xml.
Newbie
 
Join Date: Nov 2009
Posts: 10
#19: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


yeah i am not getting way to convert it into oebps format

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <!DOCTYPE package 
  3.   PUBLIC "+//ISBN 0-9673008-1-9//DTD OEB 1.2 Package//EN"
  4.   "http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd">
  5. <package>
  6.    metadata
  7.    manifest
  8.    spine
  9.    guide
  10. </package>
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#20: 2 Weeks Ago

re: Can we convert xml format to other xml format like (OEBPS)


that’s not correct.

you’ve written there text, instead of xml tags

Quote:

Originally Posted by oebpkg12.dtd

<package> must have as children elements, in this order: <metadata>, <manifest>, and <spine>, and optionally may include <tours> and/or <guide>. The 'unique-identifier' attribute is required for <package> (see comment for <dc:Identifier>.)

Reply