2010-10-20

eclipse: workspace in use message

if it is obvious that no other eclipse instance is running but you have trouble with this message, delete '.metadata/.lock' file at workspace folder.

2010-10-13

android: get device's android sdk version

android.os.Build.VERSION

ex)
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO) {
        transformXmlUrlWithXsl(url);
    }

2010-10-07

xsl: linking external css with xsl

Using XSL for dynamic XML manipulation and CSS for static browser output decoration sounds like a reasonable way for me and for the most people who stand closer to CSS than XSL yet.

<?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="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="sample.js"></script>
<head>
    <link rel="stylesheet" type="text/css" href="sample.css"/>
</head>
<body>
...

2010-10-06

xsl: document.write() is not working

When document.write is not working at xsl with your browser, setting value to DOM node's innerHTML could be an option.

Here's the simple example of xsl file.

<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<body>
    <script type="text/javascript">
    <![CDATA[
        document.write("Hello World by document.write");
    ]]>
    </script>
   
    <div class="foo" id="foo1"></div>
    <div class="foo" id="foo2"></div>
    <div class="foo" id="foo3"></div>
    <script type="text/javascript">
    <![CDATA[
        foos = document.getElementsByClassName("foo");
        for(i=0; i<foos.length; i++) {
            foos[i].innerHTML = "Hello World by innerHTML";
        }
    ]]>
    </script>
</body>
</html>



If you load this xsl with some dummy xml, IE will print out 'Hello World by document.write' only(by lack of 'getElementsByClassName' support) and FF will print out 'Hello World by innerHTML' 3 times.