view xsls/directive.xsls @ 1009:135920b5c61d

Marked strings with entities in japanese translation as literal. This allows to preserve information and produce correct output if the XML parser expands entities on input. The markup is similar to english and russian versions of the document.
author Vladimir Homutov <vl@nginx.com>
date Mon, 11 Nov 2013 11:54:16 +0400
parents be54c443235a
children 5188cb06bb13
line wrap: on
line source

<!--
  Copyright (C) Igor Sysoev
  Copyright (C) Nginx, Inc.
  -->

X:stylesheet {

    X:template = "directive" {
        <a name="{@name}"/>
        <!-- <center><h4> !{@name} </h4></center> -->
        <div class="directive">
        <table cellspacing="0">
        !! "syntax";
        !! "default";
        !! "context";
        </table>
        !! "appeared-in";
        </div>
        !! "para";
    }

    X:template = "syntax" {
        X:if "position() = 1" {
            X:text disable-output-escaping="yes" {
                &lt;tr&gt;
                &lt;td&gt;
            }
            !{document(concat($XML, '/i18n.xml'))
                       /i18n/text[@lang = $LANG]/item[@id='syntax']}
            X:text{:}
            X:text disable-output-escaping="yes" {
                &lt;/td&gt;
                &lt;td&gt;
            }
        }
        <code>
        <strong>
        !{../@name}
        </strong>
        X:if "count(node()) != 0" {
            X:text{ } !!;
        }
        X:if "@block = 'yes'" {
            X:text{ \{ ... \}}
        } else {
            X:text{;}
        }
        </code>
        <br/>
        X:if "position() = last()" {
            X:text disable-output-escaping="yes" {
                &lt;/td&gt;
                &lt;/tr&gt;
            }
        }
    }

    X:template = "default" {
        X:if "position() = 1" {
            X:text disable-output-escaping="yes" {
                &lt;tr&gt;
                &lt;td&gt;
            }
            !{document(concat($XML, '/i18n.xml'))
                       /i18n/text[@lang = $LANG]/item[@id='default']}
            X:text{:}
            X:text disable-output-escaping="yes" {
                &lt;/td&gt;
                &lt;td&gt;
            }
        }
        X:if "count(node()) = 0" {
            &#8212;
        } else {
            <pre>
            !{../@name}
            X:if "count(../syntax[@block='yes'])" {
                X:text{ \{} !!; X:text{\}}
            } else {
                X:text{ } !!; X:text{;}
            }
            </pre>
        }
        X:if "position() = last()" {
            X:text disable-output-escaping="yes" {
                &lt;/td&gt;
                &lt;/tr&gt;
            }
        }
    }

    X:template = "context" {
        X:if "position() = 1" {
            X:text disable-output-escaping="yes" {
                &lt;tr&gt;
                &lt;td&gt;
            }
            !{document(concat($XML, '/i18n.xml'))
                       /i18n/text[@lang = $LANG]/item[@id='context']}
            X:text{:}
            X:text disable-output-escaping="yes" {
                &lt;/td&gt;
                &lt;td&gt;
            }
        }
        <code>
        X:if "count(node()) = 0" {
            !{document(concat($XML, '/i18n.xml'))
                       /i18n/text[@lang = $LANG]/item[@id='context.any']}
        } else {
            !!;
        }
        </code>
        X:if "position() != last()" {
            X:text{, }
        } else {
            <br/>
            X:text disable-output-escaping="yes" {
                &lt;/td&gt;
                &lt;/tr&gt;
            }
        }
    }

    X:template = "appeared-in" {
        X:if "last() = 1" {
            <p>
            !{document(concat($XML, '/i18n.xml'))
                       /i18n/text[@lang = $LANG]/item
                       [@id='directive.version']}
            X:text{ }
            !!;.
            </p>
        } else {
            X:choose {
                X:when "position() = 1" {
                    X:text disable-output-escaping="yes" {
                        &lt;p&gt;
                    }
                    !{document(concat($XML, '/i18n.xml'))
                               /i18n/text[@lang = $LANG]/item
                               [@id='directive.versions']}
                    X:text{ }
                    !!;
                    X:if "last() > 2" {
                        X:text{,}
                    }
                    X:text{ }
                }
                X:when "position() != last()" {
                    !!;
                    X:text{, }
                }
                X:otherwise {
                    !{document(concat($XML, '/i18n.xml'))
                               /i18n/text[@lang = $LANG]/item
                               [@id='and']}
                    X:text{ }
                    !!;.
                    X:text disable-output-escaping="yes" {
                        &lt;/p&gt;
                    }
                }
            }
        }
    }
}