Giter VIP home page Giter VIP logo

Comments (8)

frederikbosch avatar frederikbosch commented on August 10, 2024

@DUnger Are you sure it is related to this library? I just pushed a test that proves that this library is behaving the same as libxslt. Or is my test wrong?

from xsl.

Lacoi avatar Lacoi commented on August 10, 2024

i don't know much about xsl. The xsl and xml file were created by other persons.
With your test file i get the result and following xml:

<ItemTypes>
    <Item id="test">
        <Requirement id="subtest" min="10"/>
        <Requirement id="subtest2" min="20"/>
        <Requirement id="subtest3" min="30"/>
        <Requirement id="subtest4" min="40"/>
    </Item>
</ItemTypes>

Result
0 => 10, 0 => 20, 0 => 30, 0 => 40

expected result:
subtest => 10, subtest2 => 20, subtest3 => 30, subtest4 => 40

i don't know if i'm doing something wrong

from xsl.

frederikbosch avatar frederikbosch commented on August 10, 2024

@DUnger That is not the expected result.

count(id(@id)/preceding-sibling::*)

This returns a count. So if we would expect something, it would be an integer, not a string. If I change the stylesheet to this.

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

    <xsl:template match="/">
        <xsl:apply-templates select=".//Requirement" mode="min"/>
    </xsl:template>

    <xsl:template match="Requirement|EffectReq" mode="min">
        <xsl:value-of select="@id"/> => <xsl:value-of select="@min"/><xsl:if test="position()!=last()">, </xsl:if>
    </xsl:template>

</xsl:stylesheet>

Then I am expecting a string because @id returns a string.

from xsl.

frederikbosch avatar frederikbosch commented on August 10, 2024

By the way, if you are using this library: you can use XSL 2.0 (that is the purpose of this library). Then you can do this.

<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
        <xsl:apply-templates select=".//Requirement" mode="min"/>
    </xsl:template>

    <xsl:template match="Requirement|EffectReq" mode="min">
        <xsl:value-of select="concat(@id, ' => ', @min)" separator=","/>
    </xsl:template>

</xsl:stylesheet>

from xsl.

Lacoi avatar Lacoi commented on August 10, 2024

Sry. i think it was my bad. I made some mistakes.
XSL: https://github.com/Uga-Agga/Game/blob/master/src/config/config.php.xsl
DTD: https://github.com/Uga-Agga/Game/blob/master/src/config/config.php.xsl

XML header:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE Config SYSTEM "config.dtd">
<Config>
....

is the config.dtd parsed/included?

from xsl.

frederikbosch avatar frederikbosch commented on August 10, 2024

@DUnger My library is not doing anything with it. So it depends if the native PHP extension is parsing/including it.

from xsl.

Lacoi avatar Lacoi commented on August 10, 2024

Ok, thank you for your help. It was my bad.

from xsl.

frederikbosch avatar frederikbosch commented on August 10, 2024

No problem, hope the package is useful.

from xsl.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.