Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2010, 10:06 AM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 9
Thanked 0 Times in 0 Posts
Default XSLT Processing shows just all the nodes (striped)

Dear,

I have an export from the Microsoft Control Center. (Identity Management from SAP runs there). The file is a massive 10 Mb & I expect it to contains all the information about the tasks dependencies.

The file looks like this :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<IDM Exported_on="2010-07-08 12:12:43.517" ImXport_Version="v.7.10.0-710_COR-BUILD-23.10.2008_17:03:45" MC_Version="7.10.3.1-SQL-2009-11-13 " ObjectType="EXPORT_IDENTITY_STORE" Schema_Version="543">
 <PRESENTATIONTYPES>
      <TYPE>
         <PRESENTATIONDESCRIPTION>Field with single line</PRESENTATIONDESCRIPTION>
         <PRESENTATIONNAME>SingleLine</PRESENTATIONNAME>
         <PRESENTATIONID>1</PRESENTATIONID>
      </TYPE>
      <TYPE> ....
Around the middle of the file, you have :
Code:
<TASKS>
<TASK> ... </TASK>
<TASK> ... </TASK>
</TASKS>
each TASK-node is app. 100 subelements from whihc I can retrieve the parents & the childs TASK's.

I made a small XSL to see if I could retrieve some of the informations :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <!--
  <xsl:output method="text" indent="no" encoding="utf-8"/>
  -->
  <xsl:template match="/IMD/IDENTITY_STORE_TOP/TASKS">
    <xsl:text disable-output-escaping="yes">
    digraph project {
      node [shape=box,fontname="Arial",fontsize="10"];
      edge [fontname="Arial",fontsize="8"];
      rankdir=LR;
       <xsl:apply-templates select="*" />
    }
    </xsl:text>
  </xsl:template>
  <xsl:template match="TASK">
    <xsl:text>TEST</xsl:text>
  </xsl:template>
</xsl:stylesheet>
The aim is to generate a DOT-file and visualize the tasks dependencies with GraphViz.

However the result is not as I expect : as many test as there are TASKs... but all the node content striped down like what follows :
Quote:
<?xml version="1.0" encoding="UTF-8"?>

Field with single line
SingleLine
1


Field with multiple line
MultiLine
2
...
Why the F#@* ... do I see these node content ?
I try to filter as much as I can by requesting:
match="/IMD/IDENTITY_STORE_TOP/TASKS"

So why do I see informations from the nodes under /IDM ?

Last but not least I use for my XSLT processing ANT XSLT task from v1.8 running on SnowLeopard with the JDK 1.6.0

Quote:
Thomas-SMETSs-MacBook-Pro:test-mcc tsmets$ java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)
Help would be greatly appreciated !

\T,
 
Old July 9th, 2010, 10:14 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Setting up a template with a certain match pattern does not specify or restrict the processing of certain nodes, only xsl:apply-templates does that so add e.g.
Code:
<xsl:template match="/">
  <xsl:apply-templates select="/IMD/IDENTITY_STORE_TOP/TASKS"/>
</xsl:template>
then only that "TASKS" element (or those "TASKS" elements if there are several) are processoed. Otherwise the default templates kick in with the results you currently see.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
tsmets (July 12th, 2010)
 
Old July 9th, 2010, 10:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Not directly relevant, but rather than generating .dot files directly, you might find it easier to generate DOTML, described here

http://www.martin-loetzsch.de/DOTML/

which can then be translated to dot. This is the process I use to generate the diagrams in the XSLT 2.1 specification.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old July 10th, 2010, 05:42 AM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 9
Thanked 0 Times in 0 Posts
Default XSLT Processing shows just all the nodes (striped)

Actually, I am supposed to document the work done by colleagues...
You know :
Customers wanted things quickly / cheap and changed their minds on things THAT many times ...
So I suggested I would make the doco's but it is pointless to try to do it manually but for the big lines.
An option is to try to extract an XPDL from the export. It would then be possible to import in the BPM-tool.

Tx for both advises.
I will see how it works on monday (week-ends are week-ends ).

Further down the line (week).
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
<!--
  <xsl:output method="text" indent="yes" encoding="utf-8"/>
-->

  <xsl:template match="/">   
    <xsl:apply-templates select="/IMD/IDENTITY_STORE_TOP/TASKS" >
      <xsl:text>Apply all templates</xsl:text>
      
      <result>
        <xsl:copy-of select="//TASK" />
      </result>
     
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="*">
      <xsl:text>TEST : STAR</xsl:text>
  </xsl:template>

  <xsl:template match="//TASK">
      <result>TEST</result>
  </xsl:template>

</xsl:stylesheet>
Copies the 700 TASKs in my output file but never prints a single "TEST" string ... I am still struggling with what could be wrong ???


\T,

Last edited by tsmets; July 12th, 2010 at 07:07 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT 1.0: Looping through nodes kwilliams XSLT 4 December 1st, 2008 06:21 PM
Processing specific Nodes Krippers XSLT 3 November 6th, 2008 05:38 AM
Array like processing (Xpath 1 / XSLT 1) akentanaka XSLT 1 July 2nd, 2008 02:22 AM
conditional xslt processing based on java array twilson997 XSLT 7 June 28th, 2006 07:32 AM
Removing nodes with an XSLT Jza XSLT 2 April 19th, 2006 10:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.