EDN Admin
Well-known member
Hi, I need to call a template or apply a template with mode, but the template name/mode are not known in the calling template - they are passed to it as param:
<div style="color:Black;background-color:White; <pre>
...
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; T1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; param<span style="color:Black; "<span style="color:Blue; >ToCall<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template<span style="color:Blue; >
...
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; T1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; param<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; apply-templates <span style="color:Red; match<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; *<span style="color:Black; " <span style="color:Red; mode<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $param<span style="color:Black; "<span style="color:Blue; /> <span style="color:Green; <!-- Here I want to call a template matching "*" with mode= "ToCall"-->
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $param<span style="color:Black; "<span style="color:Blue; /> <span style="color:Green; <!-- Here I want to call template named ToCall -->
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template<span style="color:Blue; >
[/code]
Is there any way to do it?
Now I have to do something like this:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; choose<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; when <span style="color:Red; test<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $param=ToCall<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ToCall<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; when<span style="color:Blue; >
...
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; choose<span style="color:Blue; >
[/code]
which is neither convenient nor elegant. And I need something better
Any feedback is welcome! <hr class="sig Thanks in advance -- Serge
View the full article
<div style="color:Black;background-color:White; <pre>
...
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; T1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; param<span style="color:Black; "<span style="color:Blue; >ToCall<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; with-param<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template<span style="color:Blue; >
...
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; T1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; param <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; param<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; apply-templates <span style="color:Red; match<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; *<span style="color:Black; " <span style="color:Red; mode<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $param<span style="color:Black; "<span style="color:Blue; /> <span style="color:Green; <!-- Here I want to call a template matching "*" with mode= "ToCall"-->
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $param<span style="color:Black; "<span style="color:Blue; /> <span style="color:Green; <!-- Here I want to call template named ToCall -->
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template<span style="color:Blue; >
[/code]
Is there any way to do it?
Now I have to do something like this:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; choose<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; when <span style="color:Red; test<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; $param=ToCall<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; call-template <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ToCall<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; when<span style="color:Blue; >
...
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; choose<span style="color:Blue; >
[/code]
which is neither convenient nor elegant. And I need something better
Any feedback is welcome! <hr class="sig Thanks in advance -- Serge
View the full article