Solved

XSL stylesheet

Posted on 2008-06-25
4
625 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Scraping specific data within an XML document 19 59
Problem to picture file 3 81
XSLT Help 12 33
Fixing Non-Standard characters in text 8 111
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

839 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