xsl-list
[Top] [All Lists]

Re: AW: AW: AW: change a attribute with a link?

2004-03-30 06:42:10
hallo,
many thanks, thats the answer to my question.
markus

ok, then you can use <xsl:param/> elements. there was a discussion
yesterday of this. 
short version:

put an 
      <xsl:param name="type" select="'default if not set via setParameter'"/>

at the top level of your stylesheet. the cgi/servlet/whatever which
processes your request than has to use the setParameter method of the
Transformer
(at least in java these are the names, post the language you are using and
there might someone to help) to give the URL parameter to the stylesheet.
something like
      transformer.setParameter("type", urlparamvalueAsString);
before actually call the transform() method.

the xsl:param $type can now be used as a variable in your stylesheet. so
e.g.
      <xsl:apply-templates select="descendant-or-self::node[attribute::type =
$type]" />

hope this helps
chris

      

-----Ursprüngliche Nachricht-----
Von: Markus Hanel [mailto:markus(_dot_)hanel(_at_)gmx(_dot_)at]
Gesendet: Dienstag, 30. März 2004 15:19
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: AW: AW: [xsl] change a attribute with a link?


hallo,
yes this is my question.
markus

hi,
do i understand your intention as:

- give any of the 3 links an URL parameter that should then 
be passed to
the XSL like
  <a><xsl:attribute>
name="href">test.xml?evaluate=admin</xsl:attribute>evaluate the
admin</a></p>

- XSL should then display only relevant data on the URL parameter?


chris


-----Ursprüngliche Nachricht-----
Von: Markus Hanel [mailto:markus(_dot_)hanel(_at_)gmx(_dot_)at]
Gesendet: Dienstag, 30. März 2004 13:24
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: AW: [xsl] change a attribute with a link?


hello,

the 3 links and the template " <xsl:template 
match="node[attribute::type =
'admin']">
" are in one stylesheet. the links should evaluate the same 
xml file and
there should be a possibility (I hope so) to change the 
attribute "type" at the
xslt element " apply-templates and template". is there a xslt 
element or x
path function that can transport a parameter that is 
given at a link?
So when I change the attribute "type" to interviewer all 
pers_datas of the
<node type="department">
should be catched.

do you want to open the link with a parameter which type of 
pers_data you
want to show or is this all on one file?

in case of the parameter you need to provide information 
which environment
you work in (servlet?)

if you want to put it all in one file you could do 
something like:

<xsl:template match="/">
      <!-- this is slow, better to select the proper nesting 
if possible -->
      <xsl:apply-templates select="//pers-data"/>
</xsl:template>

<xsl:template match="pers_data">
      <p>
              <!-- @ is the same as attribute:: but i think 
much neater cause it is
shorter -->
              <a href="test.xml?param={parent::node/@type}">
                      <xsl:value-of 
select="parent::node/@type"/>
              </a>
      </p>
</xsl:template>


is that what you were trying to do?
chris



-----Ursprüngliche Nachricht-----
Von: Markus Hanel [mailto:markus(_dot_)hanel(_at_)gmx(_dot_)at]
Gesendet: Dienstag, 30. März 2004 10:21
An: xsl mailinglist
Betreff: [xsl] change a attribute with a link?


hello,
I want to list some informations of pers_datas of some nodes. 
The routine is
equal for the attribut "admin", "interviewees" and 
"interviewer" of this
nodes. My idear is to make 3 links, every link opens the same 
file and evaluates
with one of the attributes: admin, interviewees or 
interviewer. Therefore I
had to change the value of "attribute::type" of the 
xslt elements:
apply-templates and template. Is there a possibility to 
arange this? 

xml file
<node type="admin">
  <pers_data></pers_data>
    <node type="school">
      <node type="interviewees">
        <pers_data></pers_data>
        <pers_data></pers_data>
        <pers_data></pers_data>
      </node>
      <node type="department">
        <node type="interviewer">
          <pers_data></pers_data>
          <pers_data></pers_data>
          <pers_data></pers_data>
        </node>
        ...


xsl file
<xsl:stylesheet>
...
<p><a><xsl:attribute 
name="href">test.xml</xsl:attribute>evaluate the
admin</a></p>
<p><a><xsl:attribute 
name="href">test.xml</xsl:attribute>evaluate the
interviewees</a></p>
<p><a><xsl:attribute 
name="href">test.xml</xsl:attribute>evaluate the
interviewer</a></p>

...
<xsl:apply-templates 
select="descendant-or-self::node[attribute::type =
'admin']" />
....................................should change to 
[attribute::type =
'interviewees']
<xsl:template match="node[attribute::type = 'admin']">
...
</xsl:template>
</xsl:stylesheet>

Many thanks
markus




--+------------------------------------------------------------------
XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




--+------------------------------------------------------------------
XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




<Prev in Thread] Current Thread [Next in Thread>