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

Re: Find several different attribute values on many e

Subject: Re: Find several different attribute values on many elements
From: "dvint dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 9 Feb 2024 01:46:12 -0000
Re:  Find several different attribute values on many  e
The performance issue in the first came from running multiple for loops on the
same content, getting down to one for loop has improved the performance.I
agree, I don't understand why changing p to * makes a difference, but it
does.I'll give your suggestion a try in the morning.Content is a bunch of dita
topics of varying lengths and complexity - technical documentation.B  I am
trying to get a distinct list of all the values in those attributes across all
the content and possible elements.Sent from my Verizon, Samsung Galaxy
smartphone
-------- Original message --------From: "Martin Honnen martin.honnen@xxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: 2/8/24  3:51 PM  (GMT-08:00)
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re:  Find several different
attribute values on many elements On 09/02/2024 00:32, dvint@xxxxxxxxx wrote:>
Here is where I'm at now>> <xsl:variable name="ditacollectionString">
B B B B select="concat($srcPath, '?select=(*.dita|*.xml)')"/>>> <xsl:template
match="/">>> <xsl:variable name="CONDITIONS" >> B B B B <xsl:for-each>
B B B B B B B  select="collection($ditacollectionString)/*" >> B B B B B B B 
<xsl:apply-templates mode="conditions"/>> B B B B </xsl:for-each>>
</xsl:variable>>> <xsl:for-each select="distinct-values(tokenize($CONDITIONS,
' '))">> B B B B <xsl:sort/>> B B B B <xsl:if test="not(. ='')">>
B B B B B B B  <xsl:value-of select="$spaceTAB"/>> B B B B B B B 
<xsl:value-of select="$spaceTAB"/>> B B B B B B B  <xsl:value-of
select="."/><xsl:text>: true</xsl:text>> B B B B B B B  <xsl:value-of
select="$RETURN"/>> B B B B </xsl:if>> </xsl:for-each>> </xsl:template>>>
B B B B <xsl:template match="text()" mode="conditions"/>>>
B B B B <xsl:template match="p" mode="conditions">> B B B B B B B  <xsl:if
test="@product">> B B B B B B B B B B B  <xsl:value-of
select="concat(@product, ' ')"/>> B B B B B B B  </xsl:if>> B B B B B B B 
<xsl:if test="@audience">> B B B B B B B B B B B  <xsl:value-of
select="concat(@audience, ' ')"/>> B B B B B B B  </xsl:if>> B B B B B B B 
<xsl:if test="@platform">> B B B B B B B B B B B  <xsl:value-of
select="concat(@platform, ' ')"/>> B B B B B B B  </xsl:if>> B B B B B B B 
<xsl:if test="@props">> B B B B B B B B B B B  <xsl:value-of
select="concat(@props, ' ')"/>> B B B B B B B  </xsl:if>> B B B B B B B 
<xsl:if test="@otherprops">> B B B B B B B B B B B  <xsl:value-of
select="concat(@otherprops, ' ')"/>> B B B B B B B  </xsl:if>> B B B B B B B 
<xsl:if test="@rev">> B B B B B B B B B B B  <xsl:value-of
select="concat(@rev, ' ')"/>> B B B B B B B  </xsl:if>>>
B B B B </xsl:template>>> This is working fine when I have the template match
on "p". My problem> is these attributes can appear on all of the elements in
the content> and more than one can appear on a given element.>> So I tried
substitution p with element() and with * and those fail to> produce
anything.>Your initial post said you got the results you want but had
performanceproblems. Is the code above supposed to give better performance or
for adifferent problem? I don't see why matching on * instead of p shouldfail,
other than of course for any children of the first element thatyou match on
and process as you don't process any child nodes.I think you might want to
take a step back and tell us what kind ofinput you have and what kind of
result you want. It is not clear, atleast not now with different code samples
that seem to do different things.If you just want a flat list of distinct
values of all those knowattributes why not do e.g. B 
distinct-values(collection(...)!(.//@audience, .//@platform, .//@props))If you
want to sort them use B  distinct-values(collection(...)!(.//@audience,
.//@platform,.//@props)) => sort()

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.