[xslt] Extension elements help request



Hi,

I wonder if anybody could help me with XSLT extension element transformation function.

That's my example stylesheet:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:my="testns"
    extension-element-prefixes="my">
    <xsl:template match="/">
        <foo>
            <my:ext>
                <xsl:attribute name="test"><xsl:value-of select="111"/></xsl:attribute>
                just some text
                <xsl:if test="some condition">
                    <bla>
                        <my:ext>
                            just some another text
                        </my:ext>
                    </bla>
                </xsl:if>
            </my:ext>
        </foo>
    </xsl:template>
</xsl:stylesheet>

If I write empty xsltTransformFunction for my:ext element, it's executed only for top level my:ext element and I have a reference to:

            <my:ext>
                <xsl:attribute name="test"><xsl:value-of select="111"/></xsl:attribute>
                just some text
                <xsl:if test="some condition">
                    <bla>
                        <my:ext>
                            just some another text
                        </my:ext>
                    </bla>
                </xsl:if>
            </my:ext> 

I need xsltTransformFunction to perform following steps:

1) Evaluate <xsl:attribute> instruction to get:

            <my:ext test="111">
                just some text
                <xsl:if test="1 = 1">
                    <bla>
                        <my:ext>
                            just some another text
                        </my:ext>
                    </bla>
                </xsl:if>
            </my:ext> 

2) Process <xsl:if> to get:

            <my:ext test="111">
                just some text
                    <bla>
                        <my:ext>
                            just some another text
                        </my:ext>
                    </bla>
            </my:ext> 

3) Execute the same xsltTransformFunction for deeper <my:ext> element.

4) After 1-2-3 steps for child nodes of <my:ext> element I need to insert the result into result document.

So, for this stylesheet example I want to get the result that looks like:

<foo>just some text<bla>just some another text</bla></foo>

In short, I need to be able to continue standart XSLT processing inside extension element.

I'm completely new to low level libxslt (I'm using python bindings) and I feel like completely dumb man trying to read the documentation... So if anybody would be so kind to make code example for me, I'll try to implement the same thing in python...

Thanks.

--
Marat


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]