[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: first warning message is printed in output using

Subject: Re: first warning message is printed in output using XSL
From: "Abel Braaksma (online)" <abel.online@xxxxxxxxx>
Date: Tue, 31 Jul 2007 11:12:56 +0200 (CEST)
Re:  first warning message is printed in output using
> Hi All,
>
> I have written the follwing XSL code to parse the XML docuemnt,
> every
> thing works fine, but last (s.no.3) print the first waring message
> always.

I am under the impression that you are mixing a couple of things up.
XSLT does not print, and a template contains a rule and is only
called when the input complies to that rule.

In this case, when the XSLT processor starts your XML
transformation, it loads the tree and starts with the very first
node, the root node (or document node), and tries to find a match
for it. The match is what you numbered #1.

In that matching template, you instruct the processor that it should
apply other templates than the default templates. In your case, the
target element with the name @main. This may (or may not, depending
on the parts you did not show) trigger the general template with '*'
(any element) matching, your number #2.

In that matching template, you instruct the processor to process all
children of this 'target' element at the child-path 'task/target'
and with the attribute @name set to 'subsystem.build.main'. I have
no clue how your input data looks like, but considering the paths
you are using and the names that you use for elements, it may not
exist, in which case nothing happens here.

Now it gets a bit tricky, because if the above is true, the #2
template does not 'print' (as you put it) anything, but it does not
process anything either and it does not do a call-template (it does,
but it is never called).

Because your named template is using a matching pattern as well, my
guess is that it is triggered by some other parts of your stylesheet
that you did not show.

As a tip for testing what goes on in apply-templates, use it with
copy-of. This will stop the recursive apply template calls, and
shows you whether a path is correct. The same is true for any other
place where you use a selection by an XPath (like in your
xsl:for-each statement).

If this does not help you, then please send the input data and the
expexted output XML along with a complete example of a working
stylesheet (see also the list guidelines) so we can help you better.


Cheers,
-- Abel Braaksma


PS: you are creating HTML and I suspect you only tested the results
in a browser. If you run it from the commandline, do you still miss
the data? It may be that you HTML is incorrect and that the browser
does not render the way you expect it. In fact, when creating HTML
with XSLT it is best practice to always check the bare output first
before testing the rendered result of a browser.


> -----------------------------------------------
> 1.
> <xsl:template match="/">
>  <html>
>    <body>
>        <xsl:apply-templates
> select="cruisecontrol/build/target[@name='main']" />
>     </body>
>  </html>
>  </xsl:template>
>
> 2.
>   <xsl:template match="*">
>     <xsl:for-each
> select="task/target[@name='subsystem.build.main']">
>           <p style="color: FFFFFF; background-color: 330066; height:
> 2px; font-size: 12pt">
>             <xsl:value-of
> select="task/target/task/message[@priority='warn']" />
>          </p>
>           <xsl:call-template name="javadoc.filter" />
>
>     </xsl:for-each>
>   </xsl:template>
>
> 3.
>   <xsl:template name="javadoc.filter"
> match="task/target[@name='subsystem.build.main']">
>        <xsl:for-each select="task/target/task/target">
>           <p style="font-size: 9pt">
>              <xsl:value-of select="task/message[@priority='warn']"
> />
>           </p>
>        </xsl:for-each>
>   </xsl:template>
> ----------------------------------------------
>
> Does somebody know see, what I am missing here ?
>
> Thanks.
>
>
>
> DISCLAIMER:
> Unless indicated otherwise, the information contained in this
> message is privileged and confidential, and is intended only for the
> use of the addressee(s) named above and others who have been
> specifically authorized to receive it. If you are not the intended
> recipient, you are hereby notified that any dissemination,
> distribution or copying of this message and/or attachments is
> strictly prohibited. The company accepts no liability for any damage
> caused by any virus transmitted by this email. Furthermore, the
> company does not warrant a proper and complete transmission of this
> information, nor does it accept liability for any delays. If you
> have received this message in error, please contact the sender and
> delete the message. Thank you.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.