ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMB XSLT engine does not indent

Post new topic  Reply to topic
 WMB XSLT engine does not indent « View previous topic :: View next topic » 
Author Message
Gideon
PostPosted: Mon Feb 08, 2010 3:01 pm    Post subject: WMB XSLT engine does not indent Reply with quote

Chevalier

Joined: 18 Aug 2009
Posts: 403

I am using WMB 7 on Windows

I wrote an XSLT using another XSLT engine, it translated it perfectly and put in indentations as requested by my XSLT stylesheet

The following is the top of the stylesheet:

Code:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:app="http://us.ibm.com/swg/app" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>


Now the following line of code should have placed indentations into the output xml:

Code:
<xsl:output method="xml" indent="yes"/>


On other XSLT engines, the output comes through with indentations, however, on the WMB XSLT engine, the data is compressed.

How can I eliminate this and get the xslt to work properly ?

Thanks
Back to top
View user's profile Send private message Send e-mail
jlaisbett
PostPosted: Mon Feb 08, 2010 10:09 pm    Post subject: Reply with quote

Apprentice

Joined: 27 Nov 2009
Posts: 39

What message domain/parser are you using after the XSLT has completed? Some of them strip whitespace for performance reasons.
Back to top
View user's profile Send private message
Gideon
PostPosted: Tue Feb 09, 2010 11:21 am    Post subject: Reply with quote

Chevalier

Joined: 18 Aug 2009
Posts: 403

After my XSLT creates a new XML file, I use the ResetContentDescriptor

I have set it to both XMLNS and XMLNSC, but in both cases I only get a Carriage return between each element. I never get any tabs to make the xml look readable (in an editor for example)

I configured the XMLNS ResetContentDescriptor as follows:

Code:
Message Domain         XMLNS
Reset Message Domain   X
Message Set            <blank>
Reset Message Set      <unchecked>
Message Type           <blank>
Reset Message Type     X
Message Format         <blank>
Reset Message Format   X


In this case each element in the output was separated by a carriage return, but no tabs preceding the sub-elements.

Then I configured the XMLNCS Reset ConentDescriptor as follows and tried again

Code:
Message Domain         XMLNSC
Reset Message Domain   X
Message Set            <blank>
Reset Message Set      <unchecked>
Message Type           <blank>
Reset Message Type     X
Message Format         <blank>
Reset Message Format   X


In this case I also had carriage returns, but did not get any tabs preceding the sub-elements.

Is there any way in which I can get WMB to place tabs before my sub-elements ?

Thanks
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Feb 09, 2010 11:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You may be seeing the data after the parsers have stripped the whitespace.

Take a trace of the data as a raw blob output from the XSLT transform node.

Confirm that you have set the right options on the XMLNSC parser to ensure that it will retain whitespace.
Back to top
View user's profile Send private message
Gideon
PostPosted: Tue Feb 09, 2010 12:06 pm    Post subject: Reply with quote

Chevalier

Joined: 18 Aug 2009
Posts: 403

I took the trace from the output of the XSLT

It comes in the format of Header plus BLOB

The data will then flow to the ResetContentDescriptor and will then be set to XML

The part I am confused on is your last suggestion.

You say to confirm I have the correct options for the parser to retain white pace. On that I have 2 questions

1> Since the XSLT trasforms the incoming XML from one format to another, the new format has a completely new structure after it leaves the XSLT node. Therefore it does not actually retain any whitespace from the original structure

2> The parser is currently putting in carriabe returns (whitespace), however, I am looking for both carriage returns and tabs.

I think the parser is set correctly, I just don't know if the parser will put in tabs as well as carriage returns (does anyone know ?)

Can anyone post a link that will help me to correctly configure the XMLNSC parser to include tabs ?

Thanks
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Feb 09, 2010 1:06 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The XML Transform node performs a BLOB-to-BLOB transformation.
We don't know ( yet) whether the XML transform node is putting the tabs into its output XML. That's why mqjeff asked you to look at the BLOB output from the node.

If you take that BLOB and parse it using XMLNSC, the mixed content ( indentation ) will be discarded. Unless you ask XMLNSC not to do that.
XMLNS never discards mixed content, so I don't think this is your problem anyway
.
Quote:
I think the parser is set correctly, I just don't know if the parser will put in tabs as well as carriage returns (does anyone know ?)
The message broker parsers do not 'put in' any white space at all. But they will preserve already-existing whitespace, as explained above.

Quote:
Can anyone post a link that will help me to correctly configure the XMLNSC parser to include tabs ?
Look on the Parser page of the input node properties. There's a property called 'Preserve mixed content' which is OFF by default.
But we don't know whether that's the cause of your problem yet...

btw - what's the requirement here. Why you need the indentation? ( just curious )
Back to top
View user's profile Send private message
Gideon
PostPosted: Tue Feb 09, 2010 2:45 pm    Post subject: Reply with quote

Chevalier

Joined: 18 Aug 2009
Posts: 403

My requirement is for my output XML to have the same indentation as the Input XML

BTW, the indentation is in spaces, not tabs, as I reported earlier.

My MQInput, XSLT, and Reset nodes are all set to XMLNS

I have a trace node connected directly from the OUT connector of my MQInput node: Below is a sample:

Code:
      (0x01000000:Element      ):owner       = (
        (0x02000000:pcdata ):                  = '    ' (CHARACTER)
        (0x01000000:Element):name              = (
          (0x02000000:pcdata): = 'string' (CHARACTER)
        )
        (0x02000000:pcdata ):                  = '    ' (CHARACTER)
        (0x01000000:Element):homePhone         = (


I also have a trace node connected directly from the OUT connector of the XSLT node, below is a sample:

Code:
      (0x01000000:Element      ):owner       = (
        (0x02000000:pcdata ):                  = '
' (CHARACTER)
        (0x01000000:Element):name              = (
          (0x02000000:pcdata): = 'string' (CHARACTER)
        )
        (0x02000000:pcdata ):                  = '
' (CHARACTER)
        (0x01000000:Element):homePhone         = (


So it appears that I lose the indentation of the original XML in the XML exiting the XSLT node.

Do you have any ideas on how I should proceed ?

Thanks
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Feb 09, 2010 3:20 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

thanks - that makes it clear where the problem is. It's the XSLT node that is stripping out indentation.

If you really care about having pretty-printed XML, you could raise a PMR. But I remain puzzled about the requirement, which seems to be connected with human readability. There are plenty of good XML viewers/editors out there...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMB XSLT engine does not indent
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.