xsl-list
[Top] [All Lists]

Re: [xsl] xsl

2006-05-03 08:16:50
On 5/3/06, Indira Hoti <IHoti(_at_)directdebit(_dot_)com> wrote:
Hi all,



I haven't got much experience with XML and I just came across a code,
like the one below, which uses 'soap: Envelope' to encapsulate data.


There's a couple of things going wrong here.

First, you need to read up on namespaces. http://www.dpawson.co.uk/xsl/sect2/N5536.html


My problem is in getting the xsl file to display that info. At the
moment with the xsl code below I can extract some information, but its
dsisplayed in one string or line, rather than assigned to a html table
cell. Any suggestions would be appreciated. Thanks J

What's happening is that your template is never matched, hence it uses
the default templates.  The default templates merely wanders down
through the tree, printing out the string values of elements.

  <soap:Body>

    <IdResponse

              xmlns="http://kkkk.com/DDiii";>

      ^^^^ so IdResponse and it's children are in the namespace
http://kkkk.com/DDii";

    <IdResult>

  <UserId>hello</UserId>

  <Username>there</Username>

<?xml version='1.0'?>

<xsl:stylesheet

  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

  xmlns="http://directdebit.com/DDLog";

  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";

   ^^^ why have some of these namespaces?  You don't use all of them.
And you're missing the one you do need to access,
http://kkkk.com/DDiii.  Add that with an appropriate prefix
(say...DDiii).

  <xsl:template match="soap:Envelope/soap:Body/IdResponse/IdResult">
                                                                          ^^^
Ok, you start the XPath correctly, but then leave out namespace for
the elements in the  http://kkkk.com/DDiii.

       <xsl:value-of
select="LogonAndGetLogByAuthenticationIdResponse/LogonAndGetLogByAuthent
icationIdResult/UserId"/>
^^^^^^
Where the heck is that path coming from?   It's not in your example
xml.  I'm assuming you meant to simplify this for an example but
didn't.  Otherwise this isn't going to match anything.  Something
like:
select="ddii:UserId"
would though.

ps: I'll do my usual rant.  Download a command-line processor like
xsltproc, Saxon or even Xalan.  Converting via the browser hides too
much for a beginning user and just adds more confusion.



Jon Gorman

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>