Michael,

Many thanks for the feedback.

Prior to my solicitation for help from this group, I'd read through (but not 
fully understood) the book "Definitive XSLT and Xpath" by G. Ken Holman. I also 
went through both the XSLT and Xpath tutorials from http://www.w3cschools.com. 
I THOUGHT I had enough information to proceed; however, it's obvious that I 
missed some critical nuances of namespaces and Xpath syntax that kept my XSL 
from being processed correctly. I'll take a look at the books you've suggested 
as additional resources.

I've had a small interchange with Nathan Nadeau about the namespace issue (and 
we've copied the list recipients on this interchange), which you've also 
defined as something I have been doing incorrectly. I'm not really clear WHY we 
need a namespace for the project I'm working on, so I'll soon be trying to 
process without a namespace specifier to see if that makes things easier to 
work with.

In response to Nathan's feedback, and your confirmation below, I made similar 
changes and re-ran my process. I'm very pleased to report that it worked, and I 
think I have enough information at this point to proceed further in some sort 
of rudimentary way.

I will take your advice and review the built-in template rules (Nathan also 
provided some useful information on that in one of our exchanges) as well as 
the identity template. I'm not sure what the latter is at this point, as I 
don't recall seeing that phrase before.

I sincerely appreciate the time you and Nathan have taken out of your day to 
assist. I hope I'll be able to return the favor soon.


Tim Hibbs
FedEx Services
350 Spectrum Loop
Colorado Springs, CO 80921
719-484-2131


-----Original Message-----
From: Michael Ludwig [mailto:mil...@gmx.de] 
Sent: Wednesday, February 17, 2010 3:04 PM
To: Xalan-J Users
Subject: Re: Output from node traversal not processing correctly

Tim Hibbs schrieb am 17.02.2010 um 10:52:39 (-0600):

> Personal Context:
>     - New to XSL, Xalan. Have taken care to try all options I can 
> think of before soliciting for assistance here. Don't fully understand 
> Debugger outputs (below).

I'd consider reading a good introductory tutorial or even a book.
Recommended teachers include:

* Michael Kay
* Jeni Tennison
* Evan Lenz

You should be able to locate books and tutorials.

> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
> <tFreightRateQuotation 
> xmlns="http://www.fedex.com/schemas/freightRateQuotation";>

Namespace declared and used!

> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

No namepace declared :-(

>     <xsl:template match="/">
>         <html>
>             <body>
>                 <xsl:apply-templates />

You need to put a suitable XPath here, else too much output.

>     <xsl:template match="To">
>             To: <xsl:value-of select="."/>
>         <xsl:apply-templates/>
>     </xsl:template>

Two items you absolutely want to learn about at the beginning:

* built-in template rules
* identity template (very common coding pattern)

> Logging information (from "Debugger Interface",

Don't worry about debugging yet.

Here's a working example:

C:\cygwin\tmp :: more /t2 tim.xsl
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0"
  xmlns:frq="http://www.fedex.com/schemas/freightRateQuotation";
  exclude-result-prefixes="frq"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output method="html" indent="yes"/>

  <xsl:template match="/">
    <html>
      <body>
        <div>
          <xsl:apply-templates select="*/frq:CommonData/frq:To"/>
        </div>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="frq:To"> To: <xsl:value-of select="."/>
  </xsl:template>

</xsl:stylesheet>

C:\cygwin\tmp :: xalan tim.xml tim.xsl
<html>
<body>
<div> To: John Customer</div>
</body>
</html>

Best,
--
Michael Ludwig

Reply via email to