Home Home > 2008 > 12 > 17
Sign up | Login

Archive for December 17th, 2008

My first trip to XSLT

December 17th, 2008 by

I found myself asking why XML formater to CSV (or what ever) should be so hard? So I started to explore XSLT stylesheets and all the bad things seems to fade a way and good things are here again!

Problem

Problem was to remove some nodes from XML-tree. There isn’t ‘good’ way to do this on XSLT (if there is please tell me!). but the XML dummy code looks like this:

<?xml version="1.0"?>
  <root>
    <node copy="0" id="1">
      <child>Child 1</child>
    </node>
    <node copy="0" id="2">
      <child>Child 2</child>
    </node>
    <node copy="0" id="3">
      <child>Child 3</child>
    </node>
    <node copy="0" id="4">
      <child>Child 4</child>
    </node>
    <node copy="1" id="5">
      <child>Child 5</child>
    </node>
    <node copy="0" id="6">
      <child>Child 6</child>
    </node>
    <node copy="1" id="7">
      <child>Child 7</child>
    </node>
    <node copy="0" id="8">
      <child>Child 8</child>
    </node>
    <node copy="0" id="9">
      <child>Child 9</child>
    </node>
    <node copy="0" id="10">
      <child>Child 10</child>
    </node>
</root>

and XSLT file for copying only copy=”1″ looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
 <root>
    <xsl:for-each select="/root/node">
     <xsl:if test="@copy='1'">
       <xsl:text>    </xsl:text>
       <xsl:copy-of select="."/>
    </xsl:if>
   </xsl:for-each>
  </root>
</xsl:template>
</xsl:stylesheet>

So its so short. Then just launch it with

xsltproc some.xsl some.xml

and there should be correct output :)

LTSP and x86_64 server x86 clients problems solved

December 17th, 2008 by

I was looking for something to solve my last problem how to heck compile binaries on x86_64 openSUSE 11.0 to KIWI-LTSP x86? I was lost.. totaly then i found this and decided to add LTSP developer tools (GCC and needed libs) and finally it worked. Only problem is that those LTSP machines are slow on building but I got to get icecream working on them :D . I admit this is not best way to solve this but seems to work…