Help - Search - Members - Calendar
Full Version: XSL for NSCRG - suggestions
Dumpshock Forums > Discussion > Community Projects
Pages: 1, 2
Fahr
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)
mcmackie
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
Grey
For those of us who don't program, what exactly is XML?
Fahr
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)
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.
Fahr
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.
mcmackie
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.
Grey
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.
mcmackie
Okay, the parser (the XML) doesn't support "pretty"ing up the output... BUT there are two programs that will automatically cleanup the output...

GuiTidy.exe 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
Fahr
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.
Spookymonster
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.
mcmackie
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
Fahr
sounds good to me!
Slicer
Would it be possible to add a more detailed section for contacts?
Fahr
sure, what additional info do you want and where do you want it?

-Mike R.
KeyMasterOfGozer
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 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
KeyMasterOfGozer
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>
KeyMasterOfGozer
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
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
Grey
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.
simonw2000
How do you get it to make a xsl file for your character?
KeyMasterOfGozer
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.
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
simonw2000
When I try to Print, I get error 76: "Path Not Found" What's up with that?!
Grey
I haven't seen that one, I'd ask in the NSRCG thread and it wouldn't hurt to shoot McMackie an email either.
KeyMasterOfGozer
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
KeyMasterOfGozer
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:
Preacher - Bear Shaman
Gordon Schumway - Dwarven Decker
Crunch - Wearbear Physad
KeyMasterOfGozer
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.
KeyMasterOfGozer
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?
Fahr
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.
KeyMasterOfGozer
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 HERE.

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
Fahr
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.
Fahr
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.
KeyMasterOfGozer
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.
Fahr
sounds like a neat Idea though... i think I am gona focus on a small footprint NPC page.

-Mike R.
KeyMasterOfGozer
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?
Fahr
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)
KeyMasterOfGozer
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.
Fahr
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.
Fahr
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
KeyMasterOfGozer
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.
Fahr
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.
KeyMasterOfGozer
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.
phelious fogg
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.
KeyMasterOfGozer
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.
phelious fogg
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

Fahr
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.
mcmackie
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
mcmackie
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
phelious fogg
Thanks Mike, didnt know i could do that, you are a godsend for the obsesive compulsive.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Dumpshock Forums © 2001-2012