Solved

XSL stylesheet

Posted on 2008-06-25
4
621 Views
Last Modified: 2013-11-18
Am trying to create a template for the font-style heading 1, but when i try to open the doc generated via the xsl style sheet it gives an error... The column specified is the "paragraph" column but it looks ok to me. what am i doing wrong?

<xsl:template match="@font-style">

<xsl:if test=".='heading 1'"><w:style w:type="paragraph" w:default="on" w:styleId="Normal"><w:name w:val="Normal"/><w:rPr><wx:font wx:val="Times New Roman"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><wx:uiName wx:val="Heading 1"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:rsid w:val="00AE7E57"/><w:pPr><w:pStyle w:val="Heading1"/><w:keepNext/><w:spacing w:before="240" w:after="60"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial"/><wx:font wx:val="Arial"/><w:b/><w:b-cs/><w:kern w:val="32"/><w:sz w:val="32"/><w:sz-cs w:val="32"/></w:rPr></w:style></xsl:if>

</xsl:template>

Open in new window

0
Comment
Question by:babeBina
4 Comments
 
LVL 4

Expert Comment

by:jimtech
ID: 21864243
I am a programmer but not that familiar with this language, you might want to check these links to see if they have the information you need:
http://www.php.net/manual/en/book.xsl.php
http://www.w3.org/Style/XSL/
http://www.w3schools.com/xsl/
0
 
LVL 10

Expert Comment

by:margajet24
ID: 21866262
give more details please..
0
 
LVL 11

Accepted Solution

by:
kmartin7 earned 500 total points
ID: 21866422
You are trying to match at attribute instead of an element. You must match an element name in your template match. So to correct your template, you must match the element(s) that contain the @font-style attributes, the perform the conditionality. For instance, if the font-style attribute that contains the value "heading 1" exists in a "p" element, then the following will work:

<xsl:template match="p">
            <xsl:if test="@font-style='heading 1'">
            ... do whatever here ...
                                          </xsl:if>
</xsl:template>

HTH,

kmartin7
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now