AW: apply diff styles/formatting to an xml element in
Hello, what exactly is your question? Do you want to format different elements with the same name different? (For example, a <SectionHeading> directly contained in a <Chapter> element shall be rendered bigger than a <SectionHeading> directly contained in a <SubSection>.) Then, modify the match attributes of the template: <xsl:template match="Chapter/SectionHeading"> <!-- context node is a SectionHeading with a Chapter parent --> </xsl:template> <xsl:template match="SubSection/SectionHeading"> <!-- context node is a SectionHeading with a SubSection parent --> </xsl:template> Or, do you want to format one particular element different in different parts of your result document? (For example, the <SectionHeading> shall appear in the table of contents and later again as a section heading.) Then, use modes. Modes DON'T require changing your input XML document. Regards, Markus __________________________ Markus Abt Comet Computer GmbH http://www.comet.de ---------- Von: SANWAL, ABHISHEK (HP-Houston) Gesendet: Montag, 4. August 2003 06:32 An: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Betreff: apply diff styles/formatting to an xml element in diff parts of XMLDoc : HOWTO How is it possible to apply different styles/formatting to an xml element in different parts of the XML document for a resulting FO document. For e.g. I have an element i.e. say - <SectionHeading> Now of course the XSL Template that matches this element will apply to the element. How would it be possible to define different FO style/block/layout/spacing to the XML elements of the same name in different parts of the FO document that is to be created. (Eventually to PDF). I know that one way would be to change the XML element tag names to something else and apply templates based on that. But we want to MAINTAIN the documents "content" model. But want to be able to apply varied types of styling by editing the XSLs. One way I was thinking was to apply "modes" but that would mean that I would have to add "modes" to the XML document. Another one I was thinking was some kind of COUNT (like in a programming language) where elements whose counts are within different ranges are worked on by different formatting/layout blocks. Of course my stylesheets would get really complicated. Can someone suggest some ideas for this WITHOUT any changes to the XML data and element model. Please do let me know or point me to a tutorial/reference to do this without complicating my stylesheet and life a lot. Thanks in advance. Abhishek Sanwal XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format