[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Howto generate a list xpath queries that are used

Subject: Re: Howto generate a list xpath queries that are used within a template?
From: "Joren Crauwels" <joren.crauwels@xxxxxxxxxxxxxxx>
Date: Sun, 22 Aug 2004 22:28:37 +0200
xpath query attribute
Hi,

ok, this is the answer i came up with so far, it filters out strings and
also checks other attributes besides slect and test (i assume one you have
to use {function()} when u use it in other attributes then select or test)
If someone has a better idea, or a better solution, please let me know. U
are always welcome to give examples of xpath-queries that wil be left out by
my function. This is the function:

<xsl:template name="generateUsedXpathQueries">
        <xsl:variable name="bla1" select="'joren'"/>
        <xsl:for-each select="@*">
            <xsl:choose>
            <xsl:when test="name() = 'select'">
                <xsl:variable name="quoteje">'</xsl:variable>
                    <xsl:if test="not(starts-with(normalize-space(.),
$quoteje)) and not(ends-with(normalize-space(.),$quoteje))">
                        <li><xsl:value-of select="."/></li>
                    </xsl:if>
            </xsl:when>
            <xsl:when test="name() = 'test'">
                <li><xsl:value-of select="."/></li>
            </xsl:when>
            <xsl:otherwise>
                <xsl:variable name="attrValue" select="normalize-space(.)"/>
                <xsl:if test="starts-with($attrValue,'{') and
ends-with($attrValue,'}')">
                    <li><xsl:value-of select="."/></li>
                </xsl:if>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:result-document href="{concat('link', '.pdf')}">
        </xsl:result-document>
        </xsl:for-each>
</xsl:template>

There is probably a shorter way to define it, but it resembles the structure
in my head :p

Grtz,
joren

----- Original Message ----- 
From: "cking" <cking@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Sunday, August 22, 2004 9:40 PM
Subject: Re:  Howto generate a list xpath queries that are used within
a template?


> Hello Joren
>
> I see what you mean, but I'm afraid I won't be able to help much:
> maybe I'm wrong, but as far as I know, this won't be possible in XSLT.
>
> 1. checking if an attribute value is an XPath query or not? Suppose you
> have an attribute value "bla", is that an XPath query? As a matter
> of fact it is, or it could be (match an element named "bla").
> (I know you know this already, but I'm only contemplating the problem
> in case someone else would have a better idea)
> The closest you can get (I think) is what you have so far: presuming
> that select and test attributes hold an XPath expression, and others
> don't. After all, if you have select="bla" it must be XPath, and if you
> have mode="bla" you can be pretty sure it's only a name. As you said,
> it's allowed to use XPath with other attributes, but the only examples
> of this I can think of are 'use' in xsl:key, and 'count', 'value' and
'from'
> in xsl:number. So, you could add these to your test.
>
> 2. generating unique IDs for linking <xsl:apply-templates> with their
> corresponding <xsl:template> is something I wanted to add to my own
> xdoc stylesheet, too, but I never found a working solution for that.
> As you pointed out, the 'select' attribute of apply-templates doesn't
> always literally match the template's 'match' attribute, so you can't
> build a link string by just using their values.
>
> Best regards
> Anton Triest
>
>
> Sunday, August 22, 2004 8:01 PM, Joren Crauwels wrote:
> > Hi,
> >
> > i know i can check on all attributes, but then i still dont know wheter
or
> > not it's an xpath query or not. The most queries are used with the
select
> > and test attribute, but its also allowed to used xpath with other
> > attributes. So my biggest problem is knowing wheter or not its an xpath
> > query or not. Maybe if it makes some things clear for u, this is my
current
> > output and xsl file:
> > http://lumumba.luc.ac.be/~jorencrauwels/jorentms/xslt2html/
> > Maybe u can also give some advice about the ID i could use after the #
in my
> > hrefs, because its not unique at the moment. For example with the list
of
> > used templates within a template, i also link to the detailed
information
> > for each template, but when i use match="./template" in stead of
> > match="template", the link isnt correct anymore. I hope this make some
> > sense...
> >
> > Bye,
> > joren

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.