Jump to content

XLST Help- HTML, font and reordering questions


dmaynard
 Share

Recommended Posts

Hello all-To give a background on the problem I'm encountering, here's what I'm trying to do:Exporting, from a tagged inDesign file, XML. What I'd like to do is create an XSLT that:1: Takes a tag such as 'hedline' and applies a formatting to it- ie bold, 14pt sans-serif (this formatting application would apply to a number of tags, specifically: hedline, abstract, byline, body.content and em, all of which are contained in the 'body' ot the xml.2: Allow a re-order of tags, incase the original inDesign file is incorrectly tag in a prescribed order. ie, I want it 'hedline, abstract, byline, body.content'3: 'This output file would be an HTML file.Below is an example- truncated- of a sample XML file that I wish to convert.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><body><sections>Comics</sections><body.head><hedline> superheroes Vs. right-wing canada   </hedline><abstract>A new comic book  is ‘definitely an art-imitating-life moment’</abstract></body.head><body.content>When news of Canada’s federal election hit Marvel comics headquarters in New York, a group of employees interrupted work on an important deadline to do a happy dance. “We jumped for joy, literally!” laughs graphic novelist Fred Van Lente via phone from Manhattan. <byline>ELIO IANNACCI</byline></body.content></body>

Here is what I have written so far. I think I'm missing something crucial and basic- I'm a relative novice to this.

<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:output method="html"/>  <xsl:template match="body">  <html><head><title>formatted XSL Example</title><style type="text/css"><!-- text that changes how the selected tags appear -->.body{margin:10px;background-color:#000000;color:#000000;font-size:10pt;font-family:verdana,helvetica,sans-serif;}.hedline{display:block;color:#000000;font-size:64pt;font-weight:bold;}.abstract{display:block;color:#000000;font-size:12pt;font-style:italic;}.em{display:block;color:#000000;font-size:10pt;font-style:italic;}.byline{display:block;color:#000000;font-size:9pt;font-style:italic;}</style></head><body><h2>This title appears in HTML</h2>  <xsl:apply-templates/></body></html></xsl:template></xsl:stylesheet>

Any help at all would be greatly appreciated. Thanks in advance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...