Printable Version of Topic

Click here to view this topic in its original format

Dumpshock Forums _ Community Projects _ XSL for NSCRG - suggestions

Posted by: Fahr Dec 8 2003, 11:16 PM

Any feedback on what you would like to see in the XSL/XML output from McMackies NSCRG? I wrote the MR version of xsl included with NSCRG, and would be more than happy to try and change this to be more useful for players/GMs

My aim in writing the first version was to include everything you would usually use in a fairly printer freindly layout, that was simple but covered everything you would normally need.

I am thinking about trying to make this into a multi page parser with a form selector at the top (gotta learn me some more xsl first) like

_________________________________________
Main Cyber Magic Decking Vehicle
_________________________________________

where the second frame would change when you clicked on one of the headings, so you could have one page freindly printouts.. but that may be a bit off...

anyway...

any suggestions are welcome. cyber.gif

-Mike R. (fahr)

Posted by: mcmackie Dec 9 2003, 12:32 AM

You already heard it but I'll say it again:
THANKS smile.gif
Note: you may discover sections that have no XML output. Let me know and I'll address the issue. I did the XML section a long time ago and there was very little interest.
For all of you people who dislike the NSRCG HTML output, here's your chance to fix it! biggrin.gif

Posted by: Grey Dec 9 2003, 12:46 AM

For those of us who don't program, what exactly is XML?

Posted by: Fahr Dec 9 2003, 07:42 AM

QUOTE

  For those of us who don't program, what exactly is XML? 


In laymans terms xml is a fancy way of saying organized data.

think of it like the filing system for your charechter(s)

you have a page for each charechter, on each page are different peices of information (like attributes, or skills) inside each group you have subgroups (natural vs augmented, knowledge/active/language) and inside those groups you cna have even more subgroups.

xml output from NSCRG is basically just like what I described above.
to make this into something you can print out or read, it has to go through a parser, that is where the xsl comes in. this is the set of rules that states how to dispaly the information in the xml files.

for the purposes of this discussion all of this is really kinda irrelevant, mostly what I want to know is - do you like what it looks like now, and how would you like it changed. the mechanics of how it works are less important for this discussion (thogh any suggestions technical or not are welcome)

- and in case you don't know how to use it, here is a very breif tutorial

after you finalize a char, click on print.
change from the html button to xml
then (in my case) click on the SR3-charachter-MR.xsl in the list box (added v3.62a i think)
then print
it will ask you to save a file with a .xml ending remember where you but this.
open the folder you just saved the xml into
drag the file to an open explorer window, it should display a charechter sheet.

-Mike R (fahr)

Posted by: Grey Dec 9 2003, 07:29 PM

Ok, thats easy enough. I already have one thing I'd like changed.

When I export to xml and open it with notepad to edit something, it would be great to have page breaks put in after each item so that its MUCH more organized and easier to find something.

Posted by: Fahr Dec 10 2003, 04:32 PM

that would be in McMackie's territory, but I can make a suggestion for how I do it...

I use Textpad4 (search google you'll find it) and created a macro that inserts a <cr> after every ">"

it would be nice if NSCRG did that for us though.

-Mike R.

Posted by: mcmackie Dec 10 2003, 07:38 PM

QUOTE (Grey)
Ok, thats easy enough. I already have one thing I'd like changed.

When I export to xml and open it with notepad to edit something, it would be great to have page breaks put in after each item so that its MUCH more organized and easier to find something.

Question: Why do you need to edit the XML file? (simply a question your GM might ask) biggrin.gif I'll look into fixing the format.

Posted by: Grey Dec 10 2003, 07:46 PM

Some things the character generator just can't handle. Like... making a Vampire character, you need to go in and edit the essense, then edit all the physical stats to account for the boosts and whatnot. There are just times that you need to edit is all and it would be nice if the format was a little more friendly to that. I love the output, its just the code is hard to browse through.

Posted by: mcmackie Dec 11 2003, 03:08 AM

Okay, the parser (the XML) doesn't support "pretty"ing up the output... BUT there are two programs that will automatically cleanup the output...

http://www.paehl.de/tidy/ and TidyGUI-EXE (I found with Google)... I prefer the GUItidy program. It is windows based and will do what you want... Remember to goto the configuration section and set the output to XML (not XHTML)... Thanks
HMM... Sorry to hijack your thread. frown.gif

Posted by: Fahr Dec 11 2003, 05:16 PM

nah, this isn't hijacking... this is what it is for, to adress XML specific issues with NSCRG, so It doens't clutter up the main thread...

smile.gif

-Mike R.

Posted by: Spookymonster Dec 22 2003, 04:22 AM

How about using the CSS display property to create collapsable sections. For example, have a Biography DIV with a link called 'SHOW ALL'. Click on the link, and it toggles the display property for the full bio text. When display=none, the text is hidden. When display=block, the text appears.

Repeat as necessary for the Weapons section, the Cyberware secton, etc.

Posted by: mcmackie Dec 23 2003, 08:24 PM

I received this and wanted your input:

QUOTE
When printing XML files it does the following on language skills:

<language><skill><name>English</name><display>English(LAN) [4]</display><rating>4</rating><linkedattribute>LAN</linkedattribute></skill><skill><name> 
English</name><display>  English(LAN) 
(RW) [2]</display><rating>2</rating><linkedattribute>LAN</linkedattribute></skill></language>


The problem here is that several XLS files use the <name> tag, that makes
the (R/W) skills apear as a second identical skill. Hope the print
functing in NSRCG can be fixed to include the (R/W) tag in language skills
in a later verison, thank you.


What do you say to replacing the [name] tag with [skillname]? Wanted to coordinate with you but also wanted input from community (of how many people?) THANKS! biggrin.gif

Edited: Oops, this may be mine to fix.. frown.gif

Posted by: Fahr Dec 30 2003, 06:11 PM

sounds good to me!

Posted by: Slicer Jan 22 2004, 01:56 PM

Would it be possible to add a more detailed section for contacts?

Posted by: Fahr Jan 22 2004, 04:31 PM

sure, what additional info do you want and where do you want it?

-Mike R.

Posted by: KeyMasterOfGozer Feb 10 2004, 06:49 PM

Hi. I’ve made a possibly improved XSL file to transform the XML output of NSRCG to printable HTML. I started with the base of the SR3-CharacterMK.xsl file included in the distribution, so most of the work is not my own, but I didn’t know who to give credit to.

Here is a my file http://oldforest.net/srchars/SR3-CharacterMG.xsl.

My changes are:

1) remove the need to have image files to include.

2) I added in the condition monitor from mcmackie's old HTML output, because I liked it better.

3) I made several sections such as CredSticks, Magic Gear, and DeckPrograms multi columner to more efficiently use the space. (this actually took me quite a lot of time to figure out, since XML transforms are not designed to work that way.)

4) Re-ordered the sections. For instance, the only time the Deck info will show up is if you have a decker character, and if you have a decker character, it doesn’t make sense to have that info at the bottom next to the Biography, so I moved it to be at a more prominent spot if there is decking info in the XML file. Also, it made more sense to me to move the MagicGear section to alongside the Spells and magic stuff rather than at the bottom of the Gear section. Once again, this was just because I think it groups items more efficiently for use.

I named the file with an “MG” on the end because that’s my initials, and I could not figure out what the naming scheme was for the supplied files, so feel free to change that however you like. Also feel free to use this Transform and distribute it as you like.

I would like to get in touch with the person who made the template I worked from to exchange some ideas. Is there a forum in which we XML guys could talk/exchange ideas about making the ultimate NSRCG character Transform?

Thanks for your hard work

Posted by: KeyMasterOfGozer Feb 10 2004, 07:06 PM

In case some one was wondering about the multi-columner table of the same items that I was talking about... (I'm proud of figuring this one out, it took me so long (maybe I'm a dolt biggrin.gif ))

Since I thought that it was a waste of space to devote a whole line to each small text for a magegear item, I thought it would be better to make 2 columns of Magegear to take up less space:

Here is the code:

CODE

<TABLE class="table" frame="box">
 <TR>
   <TH>Mage gear</TH>
   <TH>Mage gear</TH>
 </TR>
<xsl:for-each select="equipmentlist/magegearlist/magegear[position() mod 2 = 1]">
 <TR>
   <TD><xsl:value-of select="name"/></TD>
   <TD><xsl:value-of select="following-sibling::magegear[1]/name"/></TD>
 </TR>
</xsl:for-each>
</TABLE>


The two tricks being to put "[position() mod 2 = 1]" in your select parameter so that you get every other one in the list only, and then use the "following-sibling::" selector to write the next pice in the second spot.
This same trick can be used for any number of columns. Here is the one I used for 4 columns of CredSticks(don't mind the &#165's, those are just the code for Yen):
CODE

<xsl:for-each select="bio/credsticks/credstick[position() mod 4 = 1]">
 <TR class="bold" align="right">
   <TD><xsl:value-of select="."/> ¥</TD>
   <TD><xsl:value-of select="following-sibling::credstick[1]"/> ¥</TD>
   <TD><xsl:value-of select="following-sibling::credstick[2]"/> ¥</TD>
   <TD><xsl:value-of select="following-sibling::credstick[3]"/> ¥</TD>
 </TR>
</xsl:for-each>

Posted by: KeyMasterOfGozer Feb 10 2004, 09:18 PM

Ha Ha! It looks like I chose the correct file name format, and the two people to credit for the bulk of that XSL I posted earlier are Michael Rowlett & Michal Kumžák, I would guess Michal K since I used the MK version as my base.

So essentially all I added was some mulit-columner stuff and a little re-org.

I would like to compliment whoever came up with that Zalomit page breaking stuff. That is really cool. (What does "zalomit" mean?)

I would also like to explore putting all these sections on DIVs and making them collapsable. How should we go about collaborating on that?
-Mike G

Posted by: KeyMasterOfGozer Feb 10 2004, 09:48 PM

Boy do I look like a jerk for posting 4 times in a row!!!! biggrin.gif

This is a question more for the XML generator, Mr. McMackie.

It seems to me that CredSticks should have more attributes than just a value. For instance, I believe that CredSticks can function as Identification as well as cash holders. In NSRCG, you can purchase credsticks with different types of security(silver,gold, platinum), which determines what proof the user must use to be able to use (signature,thumb print, retinal scan). In addition to that You need to know the ID on that stick(or anonymous), and the Rating of the ID(or alternately if it is valid).

Anyway, the question is, do you plan on putting that info into NSRCG and thus writing it into the XML file? It would also be nice to be able to choose which CredStick(s) cash comes from when purchasing items in NSRCG. Also with that, sometimes you procure items without paying for them, so that would also be a good option.

Sorry to Broadside you, just food for thought,
-Mike G

Posted by: Grey Feb 10 2004, 11:20 PM

You don't look like a jerk, you look like someone who is interested, which makes me damn happy, cause what I lack in skill, I make up in wanting other people to make the ideas I come up with happen (ie: The Shop thread). That last post of yours you may want to put into the NSRCG thread though, as you'll get McMackie's attention faster in there.

Posted by: simonw2000 Feb 11 2004, 03:34 PM

How do you get it to make a xsl file for your character?

Posted by: KeyMasterOfGozer Feb 11 2004, 03:52 PM

QUOTE (simonw2000)
How do you get it to make a xsl file for your character?

In short, you don't. the NSRCG program doesn't do any XSL work for you, it merely generates an XML document for you to use as you wish. If you don't like any of the XSLs provided with the program, then you can make your own in any program you wish. I use Notepad, myself. biggrin.gif

The combination of the XML file with your character's data, and the XSL file that will transform it will produce an XML output that is hopefully valid HTML so your browser can display it for you.

Posted by: KeyMasterOfGozer Feb 12 2004, 08:32 PM

I'm not sure which place to post this, so I'm going to post it on both forums.

mcmackie, I know you already do so much, so it's really in poor taste for me to ask you to do more, but do you think it is possible for you to make a section on you website where people can upload XSL files for the NSRCG program, so that we can see what every one has done? I have recently stolen from MK and MR, and put together my own version of the XSL, but In short, I would like to be able to steal from more people. biggrin.gif

I think it would help us to refine our own designs to see as many examples as possible.

If you don't have the time to do this, but would like it done, I would be willing to put the PHP time into making something for you.
-Mike
bombadil<at>oldforest.net

Posted by: simonw2000 Feb 12 2004, 09:29 PM

When I try to Print, I get error 76: "Path Not Found" What's up with that?!

Posted by: Grey Feb 12 2004, 09:36 PM

I haven't seen that one, I'd ask in the NSRCG thread and it wouldn't hurt to shoot McMackie an email either.

Posted by: KeyMasterOfGozer Feb 13 2004, 05:08 AM

Ok, so I added Collapsable DIVs to my XSL transform(or I should say to my perversion of MK's XSL). Now there is an extra thing like the Page-Break things that will collapse and uncollapse each section.

I'm not sure I like the way it looks, so I'll keep working on the look. but until then, here's my first attempt:

http://oldforest.net/srchars/SR3-CharacterMG.xsl

Tell me what you guys think.
-Mike

Posted by: KeyMasterOfGozer Feb 13 2004, 05:47 AM

Ok, so now the PageBreak and Show-Hide Section buttons share the same line.

If you guys will notice, there is a line at the top that tells the Chracter's name and some small print about when it was last modified. Let's call that line the Title Line.

Do you think that one of those should be hidden at the PageBreak parts, so that when you say "Page-Break: YES", it will expose a small page header line at teh top of the next page? Or should we leave it as is, and save the one line's page real estate?

Edit:
Sorry, if you guys need to see a few samples, I have 3 you can look at:
http://www.oldforest.net/srchars/Preacher.xml
http://www.oldforest.net/srchars/GordonSchumway.xml
http://www.oldforest.net/srchars/Crunch.xml

Posted by: KeyMasterOfGozer Feb 13 2004, 06:14 AM

Breaker Breaker. All you good buddies got your ears on out there?

The MG XSL that I put out seems to be working appropriately, and the little bar that allows you to show-hide each section is not printing, but there is still a space on the page where that little bar is. DOes anyone know where I went wrong?

See my examples above.

Posted by: KeyMasterOfGozer Feb 13 2004, 06:20 AM

Ok, perhaps I spoke too soon....

I figured it out I changed the CSS file that tags along with these transforms to have a "Display:none;" in this spot:

CODE
@media print {
.zalomit {
 page-break-after: always;
}
.common {
 visibility: hidden;
 display:none;
}

.table {
 width: 17cm;
}


That fixed it up.

Speaking of that CSS file... I was thinking of just incorporating that directly into the XSL file, so I would not have 2 files to keep up with. What do you guys think? What are the ramifications of that?

Posted by: Fahr Feb 13 2004, 09:18 PM

damn! I am out of it for a week or two and someone jumps in here with so much for me to take in...

this is Mike Rowlett, I'll have to download this tonight and see what I like and don't like from what you did.

this IS the forum to talk about ideas that need to be done/want to get done with the XML/XSL stuff.

I am happy to offer webspace to host more XSls

to get the choice in the xml print pick list it needs to be in the xml subdirectory of the NSCRG directory.

let me look at the rest and then I'll have more comments.

-Mike R. (glad to see someone else excited about it)

P.S.

I want to incorporate a java file loader of some kind so I can load up all the NPCs in it and look at the xml pages as I need them, just like a binder in the real world.

Posted by: KeyMasterOfGozer Feb 14 2004, 11:33 PM

I don't know if it might help anyone, but I wrote a simple little PHP application (two pages) that list the XSL and XML files in a directory, and lets you select one of each and it will display the XML you chose transformed by the XSL you chose.

The Transform should have been easy, but the XSLT PHP functions are disabled on my provider, so I had to do some manual manipulation to get it to work.

If you want the PHP code, ask me, if you want to see it on my page, then take a look over http://www.oldforest.net/?topic=SR.

I'm still looking forward to someone letting me know weak points and strong points in my modification of MK's XSL design (check it out on my page, it's the SR3-CharacterMG.xsl file). Don't be afraid to be critical, I can roll with the punches. Come one guys, we'll make a better design if we work together!
-Mike G

Posted by: Fahr Feb 18 2004, 06:23 AM

NIce, finally got a chance to look at those, they are very nice...


I'll need top run some of my other sample guys through it to see if I can find andything that breaks.

I am trying to make mine print out a little nicer for my PCs as well as finguring out a very abbreviated format for an NPC cheat sheet...

but that looks nice.

-Mike R.

Posted by: Fahr Feb 18 2004, 06:26 AM

I think I like my weapons section a little better...

but that may just be because I don't like table borderes, they get cluttered on printouts.

-Mike R.

Posted by: KeyMasterOfGozer Feb 18 2004, 02:56 PM

I'm not sure I like the way the borders are done either, but I was just using the supplied CSS file. You could just change that in the CSS to your preferrence.

Heh. I've been playing around with putting each of these tables in their own DIVs so that you can drag them around and maximize your layout. It's pretty hard, I don't know if I'll get it all working.

Posted by: Fahr Feb 18 2004, 03:51 PM

sounds like a neat Idea though... i think I am gona focus on a small footprint NPC page.

-Mike R.

Posted by: KeyMasterOfGozer Feb 18 2004, 04:48 PM

That's a good idea, you could put more than one char in the XML file, and make something that would show up 3 or 4 per page printed. Just basic info, like Spells listed, but no other info on those spells.

Do you actually use NSRCG for NPCs?

Posted by: Fahr Feb 18 2004, 05:11 PM

yepo, takes me maybe 5 minutes to throw one together, so I build generics...
I also beta the shadowrun tracker mcM is working on, so I had incentive there too....
I only gotta make three gangers than i can use them over and over...

i prolly have close to 100 npcs built with nscrg.
also usefull when a pc kacks it.

-mike r.
(king of onehanded typeing)

Posted by: KeyMasterOfGozer Feb 18 2004, 06:52 PM

QUOTE (Fahr)
I only gotta make three gangers than i can use them over and over...

i prolly have close to 100 npcs built with nscrg.
also usefull when a pc kacks it.

-mike r.
(king of onehanded typeing)

Are you the Drummer for Def Leopard???

Sounds like we need a tool to pick a group of pre-generated generic NPC, and produce and XML file with all of them in it for this new XSL you are making for compact Char sheets.

Then the GM could just pick 5 generic Gangers and print out a sheet "5 Gangers at Corner" to have with his materials at game time.

Posted by: Fahr Feb 18 2004, 06:55 PM

yes that is it exactly!

I've been thinking of zipping up all my npcs and publishing them anyway, this ould give me an excuse!

no, I don't drum very well... but I am learning viola, to add to my brass playing abilites and my garage band level of Bass guitar...

just trying to eat and type on a computer to my left while I work on the one to my right with a mouse... (I have 6 comps in my cubicle)

-Mike R.

Posted by: Fahr Feb 19 2004, 05:11 PM

here is a preliminary of the XSL for NPC printouts... some comments, first, the spacing is done with the old white XX trick, I know I know ther are better ways to do this, but I wanted to get something out there that was a start so I can get commentary.

get it at
http://users3.ev1.net/~skywise/npc-new.xsl

comments welcome, mostly on layout at this point rather than execution (working on that now)

how did that PHP code work, I have never used PHP before but that is close to what I want to do with this, only more than one Char per page.

-mike R

edit: can't type file name arrgh

Posted by: KeyMasterOfGozer Feb 19 2004, 06:57 PM

This is at the top of the XML file generated by NSRCG:

CODE
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="SR3-CharacterMG.xsl"?>
<SR3Char>
...
</SR3Char>

As you can see, it has a tag "?xml-stylesheet" that tells your browser which XSL file to use to transform it. Since my WebHost doesn't give me access to the PHP XSLT functions (I guess because of potential to overload the processor), I made use of that stylesheet tag and just change the XSL it is refering to before sending the resultant XML to thet browser.

What we need for your multiple character display is one XML file built from several chosen characters. A resultant XML that looks something like this:
CODE
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="npc-new.xsl"?>
<SR3Chars>
  <SR3Char>
   ...Info on the first character
  </SR3Char>
  <SR3Char>
   ...Info on the second character
  </SR3Char>
 ....
  <SR3Char>
   ...Info on the n-th character
  </SR3Char>
</SR3Chars>

Then at that point, you only have to make sure you have an <xsl:for-each/> to repeat the XSL for all the characters listed.

The PHP to build that XML from checking off any number of chars should not be that hard. However, if you checked off lots of chars, it could probably get quite big.

Does anyone with more XML/XSL experience know if you could do the for-each without having to put the extra <SR3Chars> tag around the whole set? I guess I could just experiment.

Posted by: Fahr Feb 19 2004, 07:07 PM

yeah, I just built one that will handle that in a similar way, <GLOBAL> tag instead of sr3chars... but it works, problem is that requires me to cut and paste... I am wondering if frames might be the answer, but probably not...

I could always write a small prog. to move the files together with the outside tag, a chooser so to speak... that might be the easiest answer for my use...

-Mike R.

Posted by: KeyMasterOfGozer Feb 19 2004, 07:32 PM

Well, based on previous conversations, I think it would be cool for you to have a chooser for chars anyway. Wether you choose that as a web-based application, perhaps in PHP, or something compiled for Windows.

Posted by: phelious fogg Mar 7 2004, 03:06 AM

Is there an easy way to display a particular attribute from a characters xml file? Im wondering this mostly because I want the character sheet to start the attribute names with capital letters, and I can't figure how to get it to work. It's a very minor detail, but I thought I'd bring it up.

Posted by: KeyMasterOfGozer Mar 8 2004, 03:27 PM

Do you mean in a Transform (XSLT), if so then it's easy to get the data for a particular attribute. You should be able to look at any our examples, if you care to be more specific about which attribute you are looking for, I will be more specific with the code.

I don't understand what you are talking about with the capital letters, though. Maybe I misunderstand you.

Posted by: phelious fogg Mar 8 2004, 05:16 PM

So th XML stores the chracters attributes (str, bod, quick, etc) in a an attribute tag, which has subfields for the name, the unmodified, the modefied, etc. The problem I am having is testing to see the name of the attribute. The reason I'd like to be able to do this is because the XML stores the name of the attribute in all lowercase like this:

<name>body</name>

and I want to display it like this :

Body

The problem with is is that to do this, I think I need to test the name, and I dont know how to test for the value of something. I can display the value, but i dont know how to say

if (value of name == body) do (something)

Hopefully thats a better discription of my problem


Posted by: Fahr Mar 8 2004, 05:53 PM

Ok.

in the XLST there is a section that deals with the attributes,
the XSL tag <xsl:value-of select="attribute/name">
inside a <xsl:for-each select="SR3char/attributes">

like
<xsl:for-each select="SR3char/attributes">
<xsl:value-of select="attribute/name"/>
</xsl:for-each>

would give you output like
body
quickness
...

if you are trying to capitalize them than you need to approachit differently:
<xsl:for-each select="SR3char/attributes/attribute[name='body']">
Body = <xsl:value-of select="total"/><br/>
</xsl:for-each>

would give you
Body = 4

but you would need one set for each attribute.

The xml output is not capitalized.

-Mike R.

Posted by: mcmackie Mar 8 2004, 06:14 PM

QUOTE (KeyMasterOfGozer)
Boy do I look like a jerk for posting 4 times in a row!!!! biggrin.gif

This is a question more for the XML generator, Mr. McMackie.

It seems to me that CredSticks should have more attributes than just a value. For instance, I believe that CredSticks can function as Identification as well as cash holders. In NSRCG, you can purchase credsticks with different types of security(silver,gold, platinum), which determines what proof the user must use to be able to use (signature,thumb print, retinal scan). In addition to that You need to know the ID on that stick(or anonymous), and the Rating of the ID(or alternately if it is valid).

Anyway, the question is, do you plan on putting that info into NSRCG and thus writing it into the XML file? It would also be nice to be able to choose which CredStick(s) cash comes from when purchasing items in NSRCG. Also with that, sometimes you procure items without paying for them, so that would also be a good option.

Sorry to Broadside you, just food for thought,
-Mike G

I agree but am having issues with how to integrate into the program. Cred is cred is basically how SR3 default is handled. Do you automatically get a credstick on chargen? What type is it? Plat, gold, black, etc...
You also have an associated cost with a type of credstick. Gold costs so much etc...
What happens when you put more than a credstick can handle on it? There are so many questions with answers (maybe SOTA handles it) that I didn't want to get into... biggrin.gif

Posted by: mcmackie Mar 8 2004, 06:15 PM

QUOTE (KeyMasterOfGozer)
I'm not sure which place to post this, so I'm going to post it on both forums.

mcmackie, I know you already do so much, so it's really in poor taste for me to ask you to do more, but do you think it is possible for you to make a section on you website where people can upload XSL files for the NSRCG program, so that we can see what every one has done? I have recently stolen from MK and MR, and put together my own version of the XSL, but In short, I would like to be able to steal from more people. biggrin.gif

I think it would help us to refine our own designs to see as many examples as possible.

If you don't have the time to do this, but would like it done, I would be willing to put the PHP time into making something for you.
-Mike
bombadil<at>oldforest.net

Sure, send them in and I'll post. I'll even include them in the distribution! biggrin.gif

Posted by: phelious fogg Mar 9 2004, 05:04 AM

Thanks Mike, didnt know i could do that, you are a godsend for the obsesive compulsive.

Posted by: KeyMasterOfGozer Jul 12 2004, 02:24 PM

Ok, I made some farther improvement (in my opinion) of my XSLT design.

I made the armour display only the worn armour, and put the "not carried" armour in the regular not carried eqipment list. Also, the Armor section had the column with the weight of the items headed by "No.", so I chnaged that to "kg" and since the "Car" column became redundant, I switched it for the "Book" page number.

Next step is to do the total final armour calculationss from what is worn. I'm not sure how to do that in xslt language, but I'll try to figure it out.

Latest version is:
http://oldforest.net/srchars/SR3-CharacterMG.xsl

I still have heard nothing about how this design could be improved by anyone. Let us know, so we can make things better!
-Mike G

Posted by: KeyMasterOfGozer Jul 17 2004, 08:02 PM

LOL, not that anyone cares, but I have spend the morning and afternoon further refining my design.

Besides Getting rid of some Redundant fields, I added "book.page" references to every item possible.

Changes:

1) I separated the Weapons into "Carried" and "Not Carried" to be able to add "Qty" and "Book" fields to that grid.

2) Since we now have some more detailed Vehicle information in the XML (Thanks McMackie!), I added a better display for the Vehicles.

3) In my last update, I separated the "Worn" weapons and clothing from the "Not Carried". I figured out how to calculate out the Totaled armor rating to add at the bottom of the grid. Here is the code snipet if you guys want to use it for your own templates.

CODE
  <xsl:variable name="max-bal">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/ballistic">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="position()=1">
  <xsl:value-of select="." />
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="next-bal">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/ballistic">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="position()=2">
  <xsl:value-of select="." />
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="max-imp">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/impact">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="position()=1">
  <xsl:value-of select="." />
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="next-imp">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/impact">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="position()=2">
  <xsl:value-of select="." />
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>
       <TR>
           <TD class="bold divide">Totals</TD>
          <TD class="center divide">
               <xsl:value-of select="$max-bal + ($next-bal div 2)"/>
              /
              <xsl:value-of select="$max-imp + ($next-imp div 2)"/>
          </TD>
    <TD class="center divide"><xsl:value-of select="sum(equipmentlist/armorlist/armor[contains(carried,'yes')]/mass)"/></TD>
    <TD class="center divide"> </TD>
</TR>


4) I added an "Encumbrance" Attribute to the Attributes section, so I could see how close the char is to his carried items weight limit.

5) I changed the "style.css" file that came with Michal K's orginal file. Several people didn't like the "box" grid style, so I changed it to have a more subtile grid style.


So, let me know if any of these changes helped or hurt.

Latest version is:
http://oldforest.net/srchars/SR3-CharacterMG.xsl
http://oldforest.net/srchars/style.css

Posted by: KeyMasterOfGozer Jul 17 2004, 10:19 PM

Ok, I discovered one bug. If you didn't have at least 2 pieces of armor marked "carried=yes", then it would break tha calculations. I added some code to cover that problem and also if the rating was marked "-". Hopefully this covers all bases. Let me know of any other buggs, and you can still donwload from the links above.

Here is the new code snippet if anyone is interested.

CODE
<xsl:variable name="max-bal">
  <xsl:if test="equipmentlist/armorlist/armor[contains(carried,'yes')]/ballistic">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/ballistic">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="position()=1">
         <xsl:if test=". != '-'">
            <xsl:value-of select="." />
  </xsl:if>
         <xsl:if test=". = '-'">
            0
  </xsl:if>
      </xsl:if>
    </xsl:for-each>
  </xsl:if>
  <xsl:if test="not(equipmentlist/armorlist/armor[contains(carried,'yes')]/ballistic)">
    0
  </xsl:if>
</xsl:variable>
<xsl:variable name="next-bal">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/ballistic">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="last() &lt; 2">
         0
      </xsl:if>
      <xsl:if test="position()=2">
         <xsl:if test=". != '-'">
            <xsl:value-of select="." />
  </xsl:if>
         <xsl:if test=". = '-'">
            0
  </xsl:if>
      </xsl:if>
    </xsl:for-each>
</xsl:variable>
<xsl:variable name="max-imp">
  <xsl:if test="equipmentlist/armorlist/armor[contains(carried,'yes')]/impact">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/impact">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="position()=1">
         <xsl:if test=". != '-'">
            <xsl:value-of select="." />
  </xsl:if>
         <xsl:if test=". = '-'">
            0
  </xsl:if>
      </xsl:if>
    </xsl:for-each>
  </xsl:if>
  <xsl:if test="not(equipmentlist/armorlist/armor[contains(carried,'yes')]/impact)">
    0
  </xsl:if>
</xsl:variable>
<xsl:variable name="next-imp">
    <xsl:for-each select="equipmentlist/armorlist/armor[contains(carried,'yes')]/impact">
      <xsl:sort data-type="number" order="descending"/>
      <xsl:if test="last() &lt; 2">
         0
      </xsl:if>
      <xsl:if test="position()=2">
         <xsl:if test=". != '-'">
            <xsl:value-of select="." />
  </xsl:if>
         <xsl:if test=". = '-'">
            0
  </xsl:if>
      </xsl:if>
    </xsl:for-each>
</xsl:variable>
       <TR>
           <TD class="bold divide">Totals</TD>
          <TD class="center divide">
               <xsl:value-of select="$max-bal + ($next-bal div 2)"/>
              /
              <xsl:value-of select="$max-imp + ($next-imp div 2)"/>
          </TD>
    <TD class="center divide"><xsl:value-of select="sum(equipmentlist/armorlist/armor[contains(carried,'yes')]/mass)"/></TD>
    <TD class="center divide"> </TD>
</TR>



Latest version is:
http://oldforest.net/srchars/SR3-CharacterMG.xsl
http://oldforest.net/srchars/style.css

Posted by: KeyMasterOfGozer Jul 23 2004, 01:48 AM

Myself and my friends have been having a lot of trouble with NSRCG when it comes to tweaking a New character. It seems that sometimes when taking stuff away and adding other things, one gets often double charged or not charged at all. Sorry to McMackie that I can't provided any specific details about problems. I just know that when finished and we add up the things by hand, the Karma doesn't add up, or the newyen doesn't add up right.

Anyway, to combat our distrust, I have started making an XSLT that shows us the cost of all the different parts and does Sums for costs and Karma.

Here is the XSLT:
http://www.oldforest.net/srchars/NSRCG-FactChecker.xsl

Some things to note:
1) Karma for the Attributes is tallied and summed just to right of the Attributes.
2) The Active Skills' Karma are tallied and summed in the 3rd section.
3) The Newyen costs for everything except Decks and Software is tallied and summed in the 2nd section called "Cost Counts".
4) THe NSRCG XML file does not contain costs for Decks or Softwares

This is a work in Progress, and it is UGLY right now, but it might help you test NSRCG chars to make sure they really did turn out correct.

Posted by: KeyMasterOfGozer Jul 23 2004, 01:58 AM

In the process of making my Sums I discovered that XSLT is not designed to do complex things like this. smile.gif

Try summing cost * quantity when quantity is only given sometimes. smile.gif

Here is the Template I made to complete that task:

CODE
<xsl:template name="TotalCost">
 <xsl:param name="Items"/>
 <xsl:param name="RunningTotal"/>
 <xsl:choose>
  <xsl:when test="not($Items)">
   <xsl:copy-of select="$RunningTotal"/>
  </xsl:when>
  <xsl:otherwise>
    <xsl:variable name="CurrentTotal">
     <xsl:if test="$Items[1]/quantity">
       <xsl:value-of select="$RunningTotal + ($Items[1]/quantity * $Items[1]/cost)"/>
     </xsl:if>
     <xsl:if test="not($Items[1]/quantity)">
       <xsl:value-of select="$RunningTotal + $Items[1]/cost"/>
     </xsl:if>
    </xsl:variable>
  <xsl:call-template name="TotalCost">
   <xsl:with-param name="Items" select="$Items[position()>1]"/>
   <xsl:with-param name="RunningTotal" select="$CurrentTotal"/>
  </xsl:call-template>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>


Well, this only begins the complexity of calculating Karma, which is recursive and has difference multipliers at any given level depending on Attribs of the char.
Here are a few of the crazy Templates I made to get the Karma magic to happen. (Incidentally, Hats Off to McMackie; as complex as this stuff is, his prog is a miracle!)
CODE
<!-- Calculate the Karma needed to for a particular Attribute Value. -->
<xsl:template name="AttrVal">
 <xsl:param name="Attr"/>
 <xsl:param name="RaceMin"/>
 <xsl:param name="RunningTotal"/>
 <xsl:choose>
   <xsl:when test="$Attr = $RaceMin + 1 or $Attr = 1">
     <xsl:copy-of select="$RunningTotal"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:call-template name="AttrVal">
       <xsl:with-param name="Attr" select="$Attr - 1"/>
       <xsl:with-param name="RaceMin" select="$RaceMin"/>
       <xsl:with-param name="RunningTotal" select="$RunningTotal + (2 * $Attr)"/>
     </xsl:call-template>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<!-- Given an Attribute Node, this returns the Total Karma Needed -->
<xsl:template name="AttrKarma">
 <xsl:param name="Attrib"/>
 <xsl:variable name="Natural" select="$Attrib/natural"/>
 <xsl:variable name="Init" select="$Attrib/initial"/>
 <xsl:variable name="Karma">
   <xsl:call-template name="AttrVal">
     <xsl:with-param name="Attr" select="$Natural"/>
     <xsl:with-param name="RaceMin" select="$Natural - $Init"/>
     <xsl:with-param name="RunningTotal" select="0"/>
   </xsl:call-template>
 </xsl:variable>
 <xsl:value-of select="$Karma"/>
</xsl:template>

<!-- Determine the Value of a particular Attribute from it's Abbreviation -->
<xsl:template name="StatVal">
 <xsl:param name="Stat"/>
 <xsl:param name="Attribs"/>
 <xsl:choose>
   <xsl:when test="$Stat = 'BOD'"><xsl:value-of select="$Attribs[contains(name,'body')]/max"/></xsl:when>
   <xsl:when test="$Stat = 'QCK'"><xsl:value-of select="$Attribs[contains(name,'quickness')]/max"/></xsl:when>
   <xsl:when test="$Stat = 'STR'"><xsl:value-of select="$Attribs[contains(name,'strength')]/max"/></xsl:when>
   <xsl:when test="$Stat = 'INT'"><xsl:value-of select="$Attribs[contains(name,'intelligence')]/max"/></xsl:when>
   <xsl:when test="$Stat = 'CHA'"><xsl:value-of select="$Attribs[contains(name,'charisma')]/max"/></xsl:when>
   <xsl:when test="$Stat = 'WIL'"><xsl:value-of select="$Attribs[contains(name,'willpower')]/max"/></xsl:when>
   <xsl:when test="$Stat = 'MAG'"><xsl:value-of select="$Attribs[contains(name,'magic')]/max"/></xsl:when>
   <xsl:when test="$Stat = 'REA'"><xsl:value-of select="$Attribs[contains(name,'reaction')]/max"/></xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="0"/>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<!-- For a Particular Skill's Karma Cost based on it's rating -->
<xsl:template name="KarmaBuild">
 <xsl:param name="Rating"/>
 <xsl:param name="Attrib"/>
 <xsl:param name="Attribs"/>
 <xsl:param name="RunTotal"/>
 <xsl:choose>
   <xsl:when test="$Rating = 1">
     <xsl:value-of select="$RunTotal + 1"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:variable name="AttribVal">
       <xsl:call-template name="StatVal">
         <xsl:with-param name="Stat" select="$Attrib"/>
         <xsl:with-param name="Attribs" select="$Attribs"/>
       </xsl:call-template>
     </xsl:variable>
     <xsl:variable name="AttribMult">
       <xsl:choose>
         <xsl:when test="$Rating &lt;= $AttribVal"><xsl:value-of select="1.5"/></xsl:when>
         <xsl:when test="$Rating &gt; $AttribVal and $Rating &lt;= (1.5 * $AttribVal)"><xsl:value-of select="2.0"/></xsl:when>
         <xsl:when test="$Rating &gt; (1.5 * $AttribVal)"><xsl:value-of select="2.5"/></xsl:when>
</xsl:choose>
     </xsl:variable>
     <xsl:variable name="CurrentTotal" select="$RunTotal + floor($AttribMult * $Rating)"/>
     <xsl:call-template name="KarmaBuild">
       <xsl:with-param name="Rating" select="$Rating - 1"/>
       <xsl:with-param name="Attrib" select="$Attrib"/>
       <xsl:with-param name="Attribs" select="$Attribs"/>
       <xsl:with-param name="RunTotal" select="$CurrentTotal"/>
     </xsl:call-template>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<!-- A Total of Karma for ALL Skills -->
<xsl:template name="TotalSkillKarma">
 <xsl:param name="Skills"/>
 <xsl:param name="Attribs"/>
 <xsl:param name="RunningTotal"/>
 <xsl:choose>
  <xsl:when test="not($Skills)">
   <xsl:copy-of select="$RunningTotal"/>
  </xsl:when>
  <xsl:otherwise>
    <xsl:variable name="Karma">
      <xsl:call-template name="KarmaBuild">
        <xsl:with-param name="Rating" select="$Skills[1]/rating"/>
        <xsl:with-param name="Attrib" select="$Skills[1]/linkedattribute"/>
        <xsl:with-param name="Attribs" select="$Attribs"/>
        <xsl:with-param name="RunTotal" select="0"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="CurrentTotal" select="$RunningTotal + $Karma"/>
  <xsl:call-template name="TotalSkillKarma">
   <xsl:with-param name="Skills" select="$Skills[position() > 1]"/>
   <xsl:with-param name="Attribs" select="$Attribs"/>
   <xsl:with-param name="RunningTotal" select="$CurrentTotal"/>
  </xsl:call-template>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

Posted by: bit_buckethead Nov 19 2004, 08:01 PM

Does anyone know why the XML files do not display correctly in browsers other that IE? Specifically, the biography section displays the HTML formatting information in Netscape 7.2 and Mozilla 1.72. Any help would be appreciated.

Posted by: KeyMasterOfGozer Nov 19 2004, 08:56 PM

this is the xslt code snipet responsible for that:

CODE
<xsl:value-of disable-output-escaping="yes" select="biography"/>

You could try to get rid of the disable-output-escaping="yes" part, but that should be neccessary incase there is any non-XML HTML in that biography part.

Posted by: bit_buckethead Nov 20 2004, 04:32 PM

Tried removing "disable-output-escaping='yes'" but the only thing that happened was that IE6 then displayed the HTML coding the same way as Netscape and Mozilla.

Posted by: KeyMasterOfGozer Nov 22 2004, 04:43 AM

What OS are you using for Netscape and Mozilla?

I checked in the xslt specification and the disable-output-escaping is appropriate, so I'm not sure what xml engine the Mozilla type browsers are using, but I would have expected them to be closer to correct than MS's, but I guess it is not as complete.

Posted by: bit_buckethead Nov 24 2004, 10:24 PM

I have two machines, a laptop running Windows 95 and a desktop running Windows 98.
I am using Windows 95 for Mozilla 1.7.2 and Windows 98 for Netscape 7.2, Mozilla 1.7.2 and IE6 SP1. Both Mozilla and Netscape exhibit the same behavior independent of OS. I am starting to wonder if it isn't something the Gecko rendering engine. Has anyone tried either of these programs in Win XP?

Posted by: Scarecrow237 Nov 26 2004, 01:46 PM

I am using XP and have Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) as my browser. The Biography section does indeed post incorrectly here as others have said. It posts correctly in IE. on my machine.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)