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.
-Mike R. (fahr)
You already heard it but I'll say it again:
THANKS
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!
For those of us who don't program, what exactly is XML?
| QUOTE |
| For those of us who don't program, what exactly is XML? |
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.
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.
| 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. |
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.
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.
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...![]()
-Mike R.
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.
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. |
sounds good to me!
Would it be possible to add a more detailed section for contacts?
sure, what additional info do you want and where do you want it?
-Mike R.
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
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
))
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> |
| 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> |
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
Boy do I look like a jerk for posting 4 times in a row!!!!
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
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.
How do you get it to make a xsl file for your character?
| QUOTE (simonw2000) |
| How do you get it to make a xsl file for your character? |
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.
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
When I try to Print, I get error 76: "Path Not Found" What's up with that?!
I haven't seen that one, I'd ask in the NSRCG thread and it wouldn't hurt to shoot McMackie an email either.
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
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
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.
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; } |
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.
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
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.
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.
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.
sounds like a neat Idea though... i think I am gona focus on a small footprint NPC page.
-Mike R.
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?
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)
| 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) |
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.
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
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> |
| 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> |
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.
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.
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.
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.
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
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.
| QUOTE (KeyMasterOfGozer) |
| Boy do I look like a jerk for posting 4 times in a row!!!! 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 |
| 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. 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 |
Thanks Mike, didnt know i could do that, you are a godsend for the obsesive compulsive.
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
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> |
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() < 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() < 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> |
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.
In the process of making my Sums I discovered that XSLT is not designed to do complex things like this. ![]()
Try summing cost * quantity when quantity is only given sometimes. ![]()
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> |
| 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 <= $AttribVal"><xsl:value-of select="1.5"/></xsl:when> <xsl:when test="$Rating > $AttribVal and $Rating <= (1.5 * $AttribVal)"><xsl:value-of select="2.0"/></xsl:when> <xsl:when test="$Rating > (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> |
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.
this is the xslt code snipet responsible for that:
| CODE |
| <xsl:value-of disable-output-escaping="yes" select="biography"/> |
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.
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.
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?
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)