2011-10-19 7 views
0

だから、書きたいものがありました。 情報はかなり規則的で、固定形式でした。 (RPG内のクリーチャーの状態)。 だから私はXmlがこれのための素晴らしいフォーマットだと思った(ラテックスよりも優れている)。ここでXmlドキュメントを押す

は結果である:

<?xml version="1.0" encoding="utf-8"?> 
<Entity type="Oni"> 
    <Fluff> 
    <Name>Wakaalu no Oni</Name> 
    <Description> 
     It is a bit too angular to be human, its limbs look almost sharp. 
    </Description> 
    </Fluff> 
    <Cruch> 

    <Rings> 
     <Earth Stamina="4" Willpower="4" /> 
     <Fire Agility="5" Intelligence="4" /> 
     <Water Perception="3" Strength="3" /> 
     <Air Awareness="3" Reflexes="4" /> 
    </Rings> 
    <Skills> 
     <Skill Name="Jujitsu" Rank="3" /> 
    </Skills> 

    <Defense> 
     <ToHit TN="30" /> 
     <Reduction amount="10, 4 against Jade" /> 
    </Defense> 

    <Wounds> 
     <WoundRank penalty="+5" taken="16" /> 
     <WoundRank penalty="+10" taken="32" /> 
     <WoundRank penalty="+15" taken="48" /> 
     <WoundRank penalty="Dead" taken="72" /> 
    </Wounds> 

    <Attacks> 
     <Attack Name="Chop/Kick" attack="8k5" Damage="6k3" />  
    </Attacks> 

    <Abilities> 
     <SpecialAbilities> 
     <SpecialAbility name="Honour Of Jidoku"> 
      <Effect> 
      Any time anyone directly causes harm to come to the Oni, 
      they must make a willpower roll + honour,at TN=30. 
      If they fail then one of the following affects takes place: (the duration is at the GM's discression). 
      <RolledResultTable> 
       <Heading Result="Effect" Roll="1d100" /> 
       <Line Result="Immediately Lose 1 Point of Honour" Roll="0" /> 
       <Line Result="Compassion: You must spend a Void point before you are able to act on behalf of someone of lower Status or social caste." Roll="1-10" /> 
       <Line Result="Courage: When facing an opponent of higher Glory or Status, or when facing a Shadowlands opponent, the TN of all rolls you make is increased by +5." Roll="11-20" /> 
       <Line Result="Courtesy: Any time you make a Social Skill Roll to apologize or avoid giving offense, you must call a Raise for no effect, or the roll will automatically fail." Roll="21-30" /> 
       <Line Result="Duty: You cannot spend Void Points to negate Wounds." Roll="31-40" /> 
       <Line Result="Honesty: You cannot spend Void points on any Sincerity Skill Roll to which the Honesty emphasis could apply (whether or not you have the emphasis)." Roll="41-50" /> 
       <Line Result="Honor: You cannot add your Honor Rank to any roll to resist Intimidation or Temptation." Roll="51-60" /> 
       <Line Result="Sincerity: Any time you are rolling the Sincerity Skill to convince someone of what you are saying, you must call an extra Raise for no effect, or the roll automatically fails." Roll="61-70" /> 
       <Seperator /> 
       <Line Result="Control: Re-roll any Social Skill Roll, once per session," Roll="71-74" /> 
       <Line Result="Determination: Negate all TN/Wound penalties on one Skill or Spell Casting roll, once per session." Roll="75-78" /> 
       <Line Result="Insight: Re-roll any roll that used the Awareness Trait, once per session." Roll="79-82" /> 
       <Line Result="Knowledge: Re-roll any roll that used the Intelligence Trait, once per session." Roll="83-86" /> 
       <Line Result="Perfection: any one die of your choice on a Skill Roll to explode , once per session." Roll="87-90" /> 
       <Line Result="Strength: Re-roll any damage Roll, once per session." Roll="91-94" /> 
       <Line Result="Will: negate 10 Wounds at the moment they are suffered, once per session." Roll="94-98" /> 
       <Line Result="Temporally gain (a rank of) the Perceived Honour advantage." Roll="99" /> 

      </RolledResultTable> 
      </Effect> 
     </SpecialAbility> 
     </SpecialAbilities> 
    </Abilities> 
    </Cruch> 
</Entity> 

はかなり素敵なようです。 (私はそれを変更することに悪影響を及ぼしませんが) 薄い私はちょうど、RolledResultTableについてiffyビットです。

とにかく、私はこのような文書を作成したので、私はそれをより人間の消耗しやすい形にする必要があります。 私はそれにはメカニズムがあることを知っています。 XSLTと呼ばれるもの?私はCSSがこれに使用できることを知っています(私はそれを一度試してみました)が、私は事をするアドバイスされた方法を聞いていません。 私が知っている唯一の方法は、Xmlを解釈するC#プログラムを書くことです。 (これは素晴らしい解決策のようには見えません) XML文書から人間の読める形式を作るのはどうすればいいですか? テーブルではなく、見出しが少なくともある場合

答えて

1

XSLTは、XMLを別の形式に変換するために使用されます。そのXMLをHTMLやその他の書式に変更したいのであれば、XSLTはC#でXSLTホイールを再作成しようとするよりもはるかに簡単ですばらしい方法です。

CSSはあなたが持っているものをスタイリングするためのものです。フォントを設定し、色と罫線を追加して簡単に配置します。物を人間が読める形式にするのには使用されません。 XSLTはそのためのものです。このスタイルシートの中にあなたが、その後にスタイリングすることができますHTMLにあなたのXML文書を変換するために、いくつかの簡単な操作を使用することができます次に

<?xml-stylesheet type="text/xsl" href="rpg.xsl"?> 

3

は、次のようなXMLドキュメントの上部にあるXSLスタイルシートを含めますCSS。ここではいくつかの基本的なXSLです:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 
<xsl:output method="html"/> 

<xsl:template match="/"> 
<html> 
<body> 

<h2>Rings</h2> 
    <table border="1"> 
    <tr> 
    <th>Earth</th> 
    <th>Fire</th> 
    <th>Air</th> 
    <th>Water</th> 
    </tr> 
    <xsl:for-each select="Entity/Rings"> 
    <tr> 
     <td><xsl:value-of select="earth"/></td> 
     <td><xsl:value-of select="fire"/></td> 
     <td><xsl:value-of select="air"/></td> 
     <td><xsl:value-of select="water"/></td> 
    </tr> 
    </xsl:for-each> 
</table> 
</body> 

</xsl:template> 

は、この情報がお役に立てば幸いです。

これが通じ読む価値がある:http://www.w3schools.com/xsl/

+0

私はactaullyそれを試していません。しかし、私はあなたのリンクからXSLを理解しています。 valueofは属性の値をポップアップしないので、リングテーブルは空です。 –

関連する問題