Re: [xslt] xsltproc xsl:with-param not working properly




William M. Brack wrote:

>>h24-79-244-68# xsltproc new.xsl new.xml
>>
>>
>>        11 + 33 = 44
>>
>>h24-79-244-68# xsltproc --version
>>Using libxml 20423, libxslt 10019 and libexslt 710
>>xsltproc was compiled against libxml 20423, libxslt 10019 and libexslt 710
>>libxslt 10019 was compiled against libxml 20423
>>libexslt 710 was compiled against libxml 20423
>>    
>>
>
>hmmm...  I get:
>
>bill@mmm1 work $ xsltproc new.xsl new.xml
>
>
>        11 + 33 = 44
>
>        55 + 111 = 166bill@mmm1 work $ xsltproc --version
>Using libxml 20423, libxslt 10019 and libexslt 710
>xsltproc was compiled against libxml 20423, libxslt 10019 and libexslt 710
>libxslt 10019 was compiled against libxml 20423
>libexslt 710 was compiled against libxml 20423
>bill@mmm1 work $
>
>Is is just that your 'prompt' is overwriting the last line, or am I missing
>something?
>  
>

that is totally what was happening - urg, funny, i added some html 
around the thing and it works now,
plus the behaviour that originally got me looking at this small sample 
is fixed too - thanks,  now i am
having problems with something different of course - i may as well ask, 
it is regarding exsl:node-set
and selecting from them, also using values of variables for name attributes.

i will try to be clear, but i am a little fuzzy still - i am trying to 
construct xml with element names that
are stored in a variable - here is a fragment of my xsl,
the copy-of element is producing lots of output - i am using that to 
make sure that the variable $eleez
has the data i am looking for ( eleez stands for element names )
......
<xsl:template match="tr" name="get-country" >
<xsl:param name="eleez" />

<xsl:if test="td/@rowspan='3'" >
mark1
<xsl:copy-of select="exslt:node-set($eleez)" />
mark2
<xsl:element name="country"  >
<xsl:value-of select="td/text()" />
</xsl:element>

</xsl:if>
</xsl:template>
.........
... <!-- there is one of these sections for every country in my html --- 
i just show output of one -->
.....
mark1
<column-headings xmlns="dd">
  <col>Country</col>
  <col>Fiscal Year</col>
  <col>DCS Defense Communications Systems</col>
  <col>FMS Foreign Military Sales - Equipment</col>
  <col>FMS Foreign Military Sales - Construction</col>
</column-headings>
mark2
<country>Yemen</country>
....
okay, but what i wanted was simply
<Country>Yemen</Country>
and i wanted to get the element-name Country from the value stored in 
$eleez, i know this is convoluted, and perhaps your wondering why i even 
bother putting the element names in a treefrag when i already know the 
element names - i am wondering this myself
...
so this is what i am trying: (such a verbose language - i love it)
...
<xsl:template match="tr" name="get-country" >
<xsl:param name="eleez" />

<xsl:if test="td/@rowspan='3'" >

<xsl:variable name="ele-name" 
select="exslt:node-set($eleez)/column-headings/col[1]/text()" />

<xsl:element name="$ele-name"  >
<xsl:value-of select="td/text()" />
</xsl:element>

</xsl:if>
</xsl:template>
....
<$ele-name>Iraqi National 
Congress</$ele-name><$ele-name>Israel</$ele-name><$ele-name>Jordan</$ele-name><$ele-name>Kuwait</$ele-name><$ele-name>Lebanon</$ele-name><$ele-name>Maldives</$ele-name><$ele-name>Morocco</$ele-name><$ele-name>Myanmar</$ele-name><$ele-name>Nepal</$ele-name><$ele-name>Oman</$ele-name><$ele-name>Pakistan</$ele-name><$ele-name>Qatar</$ele-name><$ele-name>Saudi 
Arabia</$ele-name><$ele-name>Sri 
Lanka</$ele-name><$ele-name>Syria</$ele-name><$ele-name>Tunisia</$ele-name><$ele-name>United 
Arab Emirates</$ele-name><$ele-name>Yemen</$ele-name>
...
guess not? can not use a variable as a name attribute - so then i tried:
....
<xsl:template match="tr" name="get-country" >
<xsl:param name="eleez" />

<xsl:if test="td/@rowspan='3'" >

<xsl:variable name="ele-name" 
select="exslt:node-set($eleez)/column-headings/col[1]/text()" />

<xsl:element>
<xsl:attribute name="name" >
<xsl:value-of select="$ele-name" />
</xsl:attribute>
<xsl:value-of select="td/text()" />
</xsl:element>

</xsl:if>
</xsl:template>
....
-- no output at all - in fact i have tried a number of things trying to 
get the value "Country" which i thought should be at the 
select="exslt:node-set($eleez)/column-headings/col[1]/text() but that 
path is giving me nothing, in several attempts i get
nothing, but one lame attempt i tried 
select="exslt:node-set($eleez)//text()" and it did give me the value 
"Country" which came through in a debug value-of statement, but when i 
tried to use that value to create xsl:element / xsl: attribute as shown 
above i get no output
...

i am totally baffled every time i try to select out of a exslt:node-set 
- i usually draw a blank - no data

anyway, thanks for your help already, incidentally, i started using the 
 org.apache.xalan.xslt.Process to verify stuff, but it all fell apart 
when i started using exslt because they use different namespaces for 
their node-set, and honestly, it is slow, and i do lots of trial and 
error, i could never have learned xslt without xsltproc i would have 
pulled my hair out waiting!

darrell
ddupasedm@netscape.net



>
>_______________________________________________
>xslt mailing list, project page http://xmlsoft.org/XSLT/
>xslt@gnome.org
>http://mail.gnome.org/mailman/listinfo/xslt
>  
>





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