SQL Power Business Intelligence Productivity Tools

SQL Power Software Forum

SQL Power Software Forum

  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page  [Register] Register /  [Login] Login 
XSLT to generate a HTML report of the model  XML
Forum Index » SQL Power Architect Suggestions
Author Message
castorp


Joined: 2008-03-06 13:38:06
Messages: 129
Offline

bronius wrote:Ok, great. If the solution occurs to you one night at 4a, please stop me short. Otherwise, I will try to put a little effort in and will respond here with progress.
It was a little bit earlier that that ;)

I have attached a new version.
The (FK) indicator is a hyperlink that jumps to the referenced table (similar to the summary section that lists all foreign keys)
 Filename architect2html.xslt [Disk] Download
 Description
 Filesize 10 Kbytes
 Downloaded:  419 time(s)

bronius

[Avatar]

Joined: 2009-02-06 15:05:28
Messages: 73
Offline

oh come ON! You just can't share the glory a little..

This looks great-- you have saved the day again. On initial trial, it no longer works in Firefox for me, but I have not delved any deeper to see what else may have changed (including my own process).

Thanks castrop!
castorp


Joined: 2008-03-06 13:38:06
Messages: 129
Offline

bronius wrote:This looks great-- you have saved the day again. On initial trial, it no longer works in Firefox for me, but I have not delved any deeper to see what else may have changed (including my own process)
I wanted to generate valid XHTML. So I changed the output type to XML (line 8) when you change that back to output="html" it works again from within the browser.
The only "drawback" when you change it back is, that the output won't be valid XHTML any more, but that is mainly cosmetics.
bronius

[Avatar]

Joined: 2009-02-06 15:05:28
Messages: 73
Offline

Ok, I finally got around to adding castorp's FK addition back into "my branch" of xslt and have uploaded it here. Recall the chief differences here are that I've flipped the xslt back to invalid xhtml , have ignores his jump-to tables b/c I love the simplicity of the ul/li list at the top and have structured the whole document to make it more styleable by css.

Thanks again very much for your contributions here. It is helping tremendously.

Jonathan- Any discussion on exactly how xslt will be incorporated to allow for reporting from the interface? Hard coded? External, customizable? CSS-able at least?
 Filename architect2html.xslt [Disk] Download
 Description
 Filesize 11 Kbytes
 Downloaded:  480 time(s)

Jonathan
SQL Power Developer

Joined: 2007-01-08 15:10:32
Messages: 873
Offline

I envision something along the lines of the "database types" interface, where you will be able to set up a collection of XSLT scripts which would then be available in a submenu under File -> Generate Report or something of that nature.

And just like the database types interface, we'll include a base collection of scripts but you'll be free to add your own.

-Jonathan
bronius

[Avatar]

Joined: 2009-02-06 15:05:28
Messages: 73
Offline

This is as good a place as any other to ping castorp the XSLT wizard to see whether those awesome, user-defined labels can be easily included into the report by xslt alone.

I can see it working like this:
* goes in or in place of the References/Is Referenced By section
* makes a sentence out of the labels like this:
** [pk-table-name] + [pk-label] + [parent-child-cardinality] + [fk-table-name]
** [fk-table-name] + [fk-label] + [child-parent-cardinality] + [pk-table-name]

Example:
person may have one login
login serves many person

In my example above, I used bold text for table names, plain text for literal text typed into the labels, and italics for cardinality-determined words. Of course, in the report, no point in font style switch-ups.. except maybe on table names?..

One key point here is that "zero" in the cardinality need not (but could be?) considered-- it can be implied by the use of "may" or in the developer's literal text string labels.

I think it can be all done in the xslt.
castorp


Joined: 2008-03-06 13:38:06
Messages: 129
Offline

bronius wrote:This is as good a place as any other to ping castorp the XSLT wizard to see whether those awesome, user-defined labels can be easily included into the report by xslt alone.


"XSLT wizard" I'm flattered!

I'll have a look at it over the weekend.

Regards
Thomas

This message was edited 1 time. Last update was at 2009-04-30 02:47:52

bronius

[Avatar]

Joined: 2009-02-06 15:05:28
Messages: 73
Offline

As proof of said wizardry: I thought "hmm, I'd like to make an xslt against .architect" and voila! you'd already done it. Also, I asked for a feature request, and it was done before I could even have a look into it!

I wanted to throw another thought into the mix: table pluralization is up to the db admin's preference; I think, however, that it's generally accepted that table/entity names ought be singular. (It might throw a rails developer for a loop, but ours is dexterous in the yml!)
castorp


Joined: 2008-03-06 13:38:06
Messages: 129
Offline

Sorry for answering so late, but I was quite busy with other stuff but now I finally had the time to look into this.

bronius wrote:* goes in or in place of the References/Is Referenced By section
I don't think this is possible. Those sections list more than one table, so the label "References" could not be replaced with one of the relationship labels.

bronius wrote:makes a sentence out of the labels like this:
** [pk-table-name] + [pk-label] + [parent-child-cardinality] + [fk-table-name]
** [fk-table-name] + [fk-label] + [child-parent-cardinality] + [pk-table-name]
So I need to go for that solution, however I'm not sure where to place the label entered by the user.

The position of the label depends on the naming "convention" that is used. For example I have a table "person" that links to a "company".
My FK label reads "is member of".

I'd then expect the HTML report to read

Is member of company

with your suggestion it would read

company Is member of

which has a totally different meaning.

So I'm trying to think of a way to put this into the report that is more or less independent of the naming that is chosen.

What do you think?
bronius

[Avatar]

Joined: 2009-02-06 15:05:28
Messages: 73
Offline

Thanks for opening discussion on this. My suggestion is of course completely based on how we use the tool internally, but the way we use it internally is the way that our certified business analyst recommends..

I can see the dilemma you're having: it does seem to come down to convention. Can you post your parent/company example in more detail? At a glance, I suspect that maybe it's just a matter of getting the labels to conform to the standard convention of reading strictly from PK to FK, from FK back to PK as in "company may employ many person" and "person is a member of one company".
castorp


Joined: 2008-03-06 13:38:06
Messages: 129
Offline

bronius wrote:Thanks for opening discussion on this. My suggestion is of course completely based on how we use the tool internally, but the way we use it internally is the way that our certified business analyst recommends..

I can see the dilemma you're having: it does seem to come down to convention. Can you post your parent/company example in more detail? At a glance, I suspect that maybe it's just a matter of getting the labels to conform to the standard convention of reading strictly from PK to FK, from FK back to PK as in "company may employ many person" and "person is a member of one company".
Personally I don't really care which way to put it as I can always adjust my XSLT to our naming.

If your way is the "more standard" way, I'm happy to use that one for a start.
bronius

[Avatar]

Joined: 2009-02-06 15:05:28
Messages: 73
Offline

Ok, I would like to see what you come up with based on my earlier specs above. It will be helpful to see in action to see if it breaks because of non-conformity to convention or if there are just shortsighted holes in the logic.

Notice in particular that if there is a logic block that reads the cardinality and interprets the "one" or the "many" that the "0-or" is ignored in the relationship and is entirely up to the modeler's user-defined labels to add the appropriate "may have" text. This was the best we could come up with to handle the "company may employ many person" scenario: the xslt would throw out some pretty ridiculous sounding grammar if it were left in charge of inserting "may" and "should" appropriately..

This message was edited 1 time. Last update was at 2009-05-12 16:13:49

castorp


Joined: 2008-03-06 13:38:06
Messages: 129
Offline

OK, here is my first shot

For the cardinality I used the naming as visible in the Power*Architect dialog ("zero or more"), but that should be easily adjustable.

I added this to the XSLT that you have posted but renamed it to distinguish it to my version with the dropdown instead of the list of tables.

If no relationship label is defined, the "old" display style is used.

I did not list the columns involved in the foreign key if a label is present because it simply looks a bit weird when the columns are listed.
And the "natural language" makes it look a bit more like a conceptual so I assumed that the columns are that important at that point.



 Filename architect2html-toc.xslt [Disk] Download
 Description
 Filesize 14 Kbytes
 Downloaded:  461 time(s)

Jonathan
SQL Power Developer

Joined: 2007-01-08 15:10:32
Messages: 873
Offline

Jeff found this blog posting about the new "Export HTML" feature:

http://mixellaneous.tistory.com/657

The Google translation (Korean->English) of the posting is a bit weak, but I think it says this was a much-needed feature and he's glad to have it. So, thanks once again for the contribution!

By the way, we think this is the blog of YoungWoo Kim, who did the Korean localization for us.

-Jonathan
castorp


Joined: 2008-03-06 13:38:06
Messages: 129
Offline

Jonathan wrote:Jeff found this blog posting about the new "Export HTML" feature:

Btw: is there a way to add additional reports (not part of the jar file) so that we could customize our own and run them from within Power*Architect? e.g. by dropping them into a special directory?
 
Forum Index » SQL Power Architect Suggestions
Go to:   
Powered by JForum 2.1.8 © JForum Team