xsl-list
[Top] [All Lists]

Re: Convert apply-templates to call-template?

2006-01-31 01:29:43


You'd need to say what the problem you were having, and what exactly you
meant bu using call-tempate. You need to somehow traverse the input tree
in order to get the input, apply-templates does that, call-template does
not, the current node never changes on a call-template.

Ah, I didn't know that.

Your question could be trivially answered by having a named template
that you call with call-template, that just uses apply-templates to
traverse the tree.

Thats exactly what I'm looking for.

The app I'm using returns a very basic XML tree based on the request URL. Most of the time the main section of the document, the part that requires translation, is a nodeset showing the url as an attribute, containing lots of <item> tags which in turn contain what is essentially RDBMS row data, eg:

<container url="/Departments/ViewAll">
   <item>
      <id>1</id>
      <name>Managers</name>
      <lh>1</lh>
      <rh>6</rh>
   </item>
   <item>
      <id>2</id>
      <name>Supervisors</name>
      <lh>2</lh>
      <rh>5</rh>
   </item>
   <item>
      <id>3</id>
      <name>Employees</name>
      <lh>3</lh>
      <rh>4</rh>
   </item>
   <item>
      <id>4</id>
      <name>Directors</name>
      <lh>7</lh>
      <rh>8</rh>
   </item>
</container>

The data in the item tags changes dependent on the URL, but basically they always output <item> tags.

I'm currently passing the item nodeset to a template using <xsl:call-template /> based on the url, which is working fine for other parts of the system. The Celko technique is being used to store a BTree in SQL, which I need to reproduce based on the lh and rh tags.

I don't think <xsl:apply-templates /> will work, because I can't match the <item> tag as there are other parts of the app which use it.

Any advice would be great.

--~------------------------------------------------------------------
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>