Subject: RE: [xsl] Templates From: "SINGH Navpreet" <Navpreet.SINGH@xxxxxxxxx> Date: Thu, 6 Sep 2007 13:25:40 +1000 |
Here is my <PARA> template <xsl:template match="PARA"> <xsl:param name="indent">1.</xsl:param> <xsl:variable name="indentValue"><xsl:value-of select="$indent" /></xsl:variable> <xsl:if test="ancestor::WARNING[name()='WARNING']"> <fo:block font-size="12pt" font-family="serif" font-weight="bold" text-align="left" margin-left="{$indentValue}" margin-bottom="10pt" color="red"><xsl:text>WARNING: </xsl:text> <fo:inline font-size="11pt" font-family="serif" font-weight="normal" color="black"> <xsl:value-of select="text()"/> </fo:inline> </fo:block> </xsl:if> <xsl:if test="ancestor::NOTE[name()='NOTE']"> <fo:block font-size="12pt" font-family="serif" font-weight="bold" text-align="left" margin-left="{$indentValue}" margin-bottom="10pt" color="black"><xsl:text>NOTE: </xsl:text> <fo:inline font-size="11pt" font-family="serif" font-weight="normal"> <xsl:value-of select="text()"/> </fo:inline> </fo:block> </xsl:if> <xsl:if test="ancestor::CAUTION[name()='CAUTION']"> <fo:block font-size="12pt" font-family="serif" font-weight="bold" text-align="left" margin-left="{$indentValue}" margin-bottom="10pt" color="red"><xsl:text>CAUTION: </xsl:text> <fo:inline font-size="11pt" font-family="serif" font-weight="normal" color="black"> <xsl:value-of select="text()"/> </fo:inline> </fo:block> </xsl:template> What should be done to display the <PARA>TESTING DATA</PARA>, to the output file. Thanks, Navpreet -----Original Message----- From: SINGH Navpreet [mailto:Navpreet.SINGH@xxxxxxxxx] Sent: Thursday, 6 September 2007 1:17 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Templates Hi, I was given this DTD to write xsl. XML document has not been provided yet. I have to use Element name as heading and the text() as text against that heading. So xml could be as follows: <?xml version="1.0" encoding="UTF-8"?> <PAGE> <TITLE>PAGE10</TITLE> <PARA0> <TITLE>PARA0 123</TITLE> <CAUTION> <PARA>Just a CAUTION</PARA> </CAUTION> <NOTE> <PARA>Very important note.</PARA> </NOTE> <PARA>TESTING DATA</PARA> <NOTE> <PARA>TESTING NOTE AFTER PARA</PARA> </NOTE> <SUBPARA1> <PARA>This is subpara1</PARA> </SUBPARA1> </PARA0> </PAGE> OTPUT should be as follows: PAGE10 PARA0 123 CAUTION: Just a CAUTION NOTE: Very important note. TESTING DATA NOTE: TESTING NOTE AFTER PARA This is subpara1. I am not sure how to implement, "( (NOTE+, (PARA, NOTE*)?) | (PARA, NOTE*))?" out of "(TITLE, WARNING*, CAUTION*, ( (NOTE+, (PARA, NOTE*)?) | (PARA, NOTE*))?, SUBPARA1*, REFITEM*)". Give it a try. Thanks, Navpreet. -----Original Message----- From: XSL-List Owner [mailto:xsl-list-owner@xxxxxxxxxxxxxxxxxxxxxx] Sent: Thursday, 6 September 2007 11:01 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Templates You will improve the chances that you will receive prompt and helpful responses on XSL-List by: - asking specific enough questions that answers are possible. Describe what you are trying to do, how you approached it, what happened, and why you don't like the result you got - supplying small samples of files that illustrate your question or problem. For example, an XML file, an XSLT stylesheet, the result you got, and the result you want - all in miniature (and remembering that everything posted to XSL-List is archived in public) - describing the topic of your question concisely in the subject line Good subject lines - those that describe the subject matter of your message - not only increase the chances that you will receive answers to questions or responses to comments, they also make your message and any replies to it accessible in the list archives. While I'm sure there are people on XSL-List who will try to guess what your question is about, you have really not provided enough information to make it easy to help you. Please re-submit your question with the samples described above. -- Tommie At 10:33 AM +1000 9/6/07, SINGH Navpreet wrote: >Hi All, > >I have following DTD for Element PARA0 > > > >(TITLE, WARNING*, CAUTION*, ( (NOTE+, (PARA, NOTE*)?) | (PARA, NOTE*) >)?, SUBPARA1*, REFITEM*) > > > >I am writing xslt to transform my xml document with this PARA0 element. >I am applying templates for TITLE, WARNING*, CAUTION*, SUBPARA1*, >REFITEM*. These are quite straight forward, but I am struggling to write >a template that can handle ( (NOTE+, (PARA, NOTE*)?) | (PARA, NOTE*) )? >part of the DTD. Can anyone help me with this. > > > >Thanks, > >Navpreet. -- ====================================================================== B. Tommie Usdin mailto:btusdin@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Phone: 301/315-9631 Suite 207 Direct Line: 301/315-9634 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in XML and SGML ====================================================================== Disclaimer : The contents of this e-mail including any attachments are intended only for the person or entity to which this e-mail is addressed. If you are not, or believe you may not be, the intended recipient, please advise the sender immediately by return e-mail, delete this e-mail and destroy any copies. Tenix does not warrant nor guarantee that this email communication is free from errors, virus, interception or interference. Disclaimer : The contents of this e-mail including any attachments are intended only for the person or entity to which this e-mail is addressed. If you are not, or believe you may not be, the intended recipient, please advise the sender immediately by return e-mail, delete this e-mail and destroy any copies. Tenix does not warrant nor guarantee that this email communication is free from errors, virus, interception or interference.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Templates, David Carlisle | Thread | [xsl] Fwd: level grouping problem, Maria Shvedova |
RE: [xsl] Templates, SINGH Navpreet | Date | [xsl] Search text and write the cod, Byomokesh Sahoo |
Month |