<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/xml.xsl" type="text/xsl"?><feed xmlns="http://www.w3.org/2005/Atom">
  <title>nulog, NULL::something : out of the headphone &gt; 2005 &gt; July &gt; 03</title>
  <link href="http://lowreal.net/logs/2005/07/03"/>
  <icon>http://lowreal.net/img/banner.png</icon>
  <link rel="self" type="application/atom+xml" href="http://lowreal.net/logs/2005/07/03.atom"/>
  <link rel="alternate" type="application/xhtml+xml" href="http://lowreal.net/logs/2005/07/03.xhtml"/>
  <updated>2005-07-03T14:17:58+09:00</updated>
  <author>
    <name>cho45(砂糖)</name>
  </author>
  <id>http://lowreal.net/2005/07/03</id>
  <entry>
    <title>リハビリと ruby-xslt</title>
    <link rel="alternate" type="text/html" href="http://lowreal.net/logs/2005/07/03/1.html"/>
    <link rel="alternate" type="application/xml+xhtml" href="http://lowreal.net/logs/2005/07/03/1.xhtml"/>
    <updated>2005-07-03T01:47:08+09:00</updated>
    <published>2005-07-03T01:47:08+09:00</published>
    <id>http://lowreal.net/2005/07/03/1</id>
    <category term="web"/>
    <category term="xml"/>
    <category term="xslt"/>
    <content type="xhtml" xml:base="http://lowreal.net/">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>ruby-xslt 使うと <abbr title="XSL Transformations">XSLT</abbr> から Ruby のメソッドを呼べるみたいなので、とても使ってみたい。（何をするか、はともかく）</p>
        <p>ただ、ちょっと実装が残念な形。</p>
        <blockquote title="test_function.rb">
          <pre class="Ruby">
class XML::XSLT
    def round_trip( arg )
        arg
    end
    def type( arg )
        arg.class.to_s
    end
end

xslt = XML::XSLT.new()
xslt.xsl = "functions.xsl"
xslt.xml = "test.xml"
xslt.extFunction("roundTrip", "http://test.none", xslt, "round_trip")
xslt.extFunction("type", "http://test.none", xslt, "type")
</pre>
        </blockquote>
        <p>俺としては Proc オブジェクトとか、ブロックを直接渡したい。すなわち次のように</p>
        <pre class="Ruby">
xslt.extFunction("roundTrip", "http://test.none/", xslt) do |arg|
    arg
end
#または
round_trip = lambda {|arg| arg}
xslt.extFunction("roundTrip", "http://test.none", xslt, round_trip)

# あるいはまとめたクラス / インスタンスを登録する形。
# もとのヤツに似ているけど名前が衝突しない。
class XSLTFunctions
    def round_trip(arg)
        arg
    end

    def type(arg)
       arg.class.to_s
    end
end

xslt.set_ext_functions("http://test.none", XSLTFunctions) # XSLTFunctions.new
# この場合 XSLT から呼ぶ関数名は Ruby でのメソッド名と同じになる。とか。

# やはり Ruby は書いていて気持ちいい。
</pre>
        <p>ちょっとどうでもいいけど、なんかこの <abbr>PC</abbr> 描画がおかしい。温度のせい?</p>
        <ins datetime="2005-07-03T01:56:53+09:00">
          <p>再起動したらなおった？ ちょっと時間おかないと分からない。</p>
          <p>限りなく不安定な <abbr>PC</abbr> だ。グラフィックボードにもファンがついているから、グラフィックボードが暑くて困っているのかもしれない。しかしゲームのとき気にならない (or 症状が出ていない？) のはなぜだろう。最も影響うけやすそうなんだけど。</p>
        </ins>
      </div>
    </content>
  </entry>
  <entry>
    <title>新しい日記システムはいつできるのか。</title>
    <link rel="alternate" type="text/html" href="http://lowreal.net/logs/2005/07/03/2.html"/>
    <link rel="alternate" type="application/xml+xhtml" href="http://lowreal.net/logs/2005/07/03/2.xhtml"/>
    <updated>2005-07-03T02:18:44+09:00</updated>
    <published>2005-07-03T02:18:44+09:00</published>
    <id>http://lowreal.net/2005/07/03/2</id>
    <category term="web"/>
    <content type="xhtml" xml:base="http://lowreal.net/">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>日々頭が悪くなっていく cho45 です。こんにちは。（前にも書いたけどこういう書き出し嫌い。いやむしろ好き？）</p>
        <p>ローカルで更新部分を生成させてアップロードさせる形って実は素敵なのかな、ってちょっと思ったり。でもサーバー上で完全動的にやるのも更新する側としては楽なのかなって思ったり……たった今一瞬の気持ちは前者に傾いております。なぜならローカルで動いてさえくれれば、サーバーと同じ環境をローカルに作ってテストする、といった途方もなく面倒くさい行為をしなくてすむからです。記憶によるとローカルでは ruby-xslt が動いた気がする。</p>
        <p>ただ、私はいったんアップロードしたあとブラウザ上で数回読み直して typo とか見つけるので、何回もローカルで再構築させながらアップロードするのはアレかな、とも思うのです。ひとつのファイルが数個から数十個のファイルになるような感じなので、何度も思いつきをアップロードしまくりんぐなのは良くないのかな、と。</p>
        <p>flickr のタグ機能みたいに、日記に使っているタグを集計し、頻度・新しさを考慮したうえで表示できたら面白いと思うのだけど、うまくいくかなぁ。</p>
        <ul>
          <li>カテゴリではなく、タグにするので、パス表記 (スラッシュ区切り) をやめるし、<abbr title="Uniform Resource Identifer | Universal Resource Identifer">URI</abbr> のソレっぽいのも実装しない。</li>
          <li>月に1個程度のファイルにする。（前セッションを復元するエディタを使いさえすれば、起動したらすぐ書ける）</li>
          <li><abbr title="Extensible Markup Language">XML</abbr> で書ける。あるいは Markdown でもいいかもしれない、と最近思う。<abbr title="Extensible Markup Language">XML</abbr> ってそのまんま読んでも「読みやすいぜ！」ってもんじゃないですし。</li>
          <li>ぶっちゃけ Markdown 使うならほとんど blosxom でいいじゃん。blosxom + xyzzy lisp とか……</li>
          <li>そしてだんだん <abbr title="Extensible Markup Language">XML</abbr>, <abbr title="XSL Transformations">XSLT</abbr> から離れていく。</li>
          <li>まーしかし <abbr title="XSL Transformations">XSLT</abbr> を使わないと、そのシステムを使用しないほかのコンテンツとの統一性をとるのが面倒になってしまうのが問題なのですが……</li>
        </ul>
      </div>
    </content>
  </entry>
  <entry>
    <title>ruby-xslt</title>
    <link rel="alternate" type="text/html" href="http://lowreal.net/logs/2005/07/03/3.html"/>
    <link rel="alternate" type="application/xml+xhtml" href="http://lowreal.net/logs/2005/07/03/3.xhtml"/>
    <updated>2005-07-03T14:17:58+09:00</updated>
    <published>2005-07-03T14:17:58+09:00</published>
    <id>http://lowreal.net/2005/07/03/3</id>
    <category term="web"/>
    <category term="xslt"/>
    <content type="xhtml" xml:base="http://lowreal.net/">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>configure make make configure -opt make make とかウザい。</p>
        <p>それはともかく、拡張できないよ。<code>/..snip../ruby-xslt/extfunc.c:57: undefined reference to `_xml*'</code> が永遠出る。ライブラリは指定されているみたいなんだけど……意味がわからない。cygwin ruby-xslt とかでぐぐってもこのサイトがでてきてウザい。</p>
        <p>なんで環境によってライブラリ・ヘッダーファイルのパスが違うとかいうバカげた状況なんだろう。configure とかうざい。うざい。</p>
        <p>あれだよね、拡張ライブラリは作る時点で八割りがたウマくいかないし、Pure Ruby なライブラリは使うときにウマくいかない。スーパーハカーなら自分で作るんだろうなぁ。</p>
      </div>
    </content>
  </entry>
</feed>
