问题
I'd like our magazine team to be able to download website data in a file that Adobe InDesign can read. They can then import/open the file, make a few tweaks, and cut out a vast deal of repetitive manual labour (they currently use copy&paste for a few hours).
After a brief Google I note that v2 of InDesign can import/export XML so perhaps that is my best bet? Are there any alternatives, and can anyone offer any advice on them?
I am using a PC, and the magazine team are on Macs; testing will be tiresome I fear.
The data we wish to format is fairly simple - a title followed by a short chunk of text (repeated about 50 times, say). I'll ask about importing images later.
Thanks for your help. I will return to Google now, but it would be great if anyone can point me in a more specific direction first!
回答1:
There is a xhtml to idml (indesign markup language) xsl template in the latest indesign sdk. You can start with that to help you format your idml output.
Here is a link to the sdk: http://www.adobe.com/devnet/indesign/sdk/
Download the "products" version. The xsl file is in this path in the zip file: devtools/sdktools/idmltools/samples/icmlbuilder/xsl/icml.xsl
Because of the mac issue, you can have them 'save' a xhtml file to a shared directory, you can then create a utility program to watch that directory and transform the saved files to an output directory.
Otherwise, there is a firefox add-on to transform xml files called XSL Results: https://addons.mozilla.org/en-US/firefox/addon/5023
I have not used it myself but it appears it could do the job of transforming the xhtml to idml for you on a mac...
回答2:
There are several possible answers to this question. Since I can't see a sample of the HTML to give an education answer, I'll give you several possible answers:
InDesign has been able to import XML from version CS, at least. It's not very powerful back then, but since CS3 it has been improved.
HTML if written to XHTML standards is basically XML. All tags must be properly closed, balanced and nested. InDesign will fail to import any file that is not well-formed. You can use InDesign's XML import feature to import HTML if you first save the HTML file with an .XML extension. InDesign is very literal in the file naming area. I have done this several times as an experiment and it works as long as the file is well-formed.
This method, however brings in a lot of trash and junk you probably don't want or need. A better way to import the HTML contents is to create an XSLT that will select only the element and contents that you desire.
Create an XSLT that selects only the contents of the HTML file that you desire, for example the
<p>, <h1-h6>, <img>
elements. If you use the XSLT to convert HTML references to XML image references, InDesign will also import the images themselves. The XSLT can be written to ignore the scripts and other code that isn't necessary. To use the XSLT you would change the extension of the HTML file to XML and then load the XSLT from the XML import dialog.Create an XSLT that converts the HTML to XML directly. You can parse the HTML outside of InDesign or during import. As with the previous suggestions, if you want to import to InDesign directly you will have to first change the extension of the file to XML.
You can get a complete description of the XML features from my book: A Designer's Guide to Adobe InDesign and XML (Adobe Press, 2008) and a more recent description from my Lynda.com video tutorials: InDesign CS5: Dynamic Publishing Workflows in XML.
If you had some HTML examples, I could give you more specific help.
回答3:
In Indesign create a sample of what you would like to automate. Using character and paragraph styles.
Select the sample, and Go to File | Export .
Open this file in a text editor. This will give you the basic structure you are trying to create. You can use whatever tech you like to fill it in..
Then once you have saved the snippet. You can drag the file onto an Indesign page to create the new item.
回答4:
Some other stuff that I found myself:
Blog about XML import which mentions XSL and some steps you should take in the process
Adobe InDesign CS3 and XML : A technical reference
回答5:
I'm using InDesign's Javascript to import data from mysql database into InDesign. There are some custom-made functions that place text and images, having arguments like page no, coordinates, paragraph style's name etc. Then there are many (1000+) calls to these functions, generated by php script that takes data from db and calculates pages and coords. After running this Javascript, it takes few seconds to place everything exactly where needed.
I don't know if latest versions of InDesign have more possibilities but, having that question with InDesign CS, I wasn't able to create automatically those 1000+ placeholders' objects I needed, so I found another way...
来源:https://stackoverflow.com/questions/1508807/getting-website-data-into-adobe-indesign