Rectangle 27 112

Don't put any Condition Expression in Template.

<input ng-click="check(profileForm.$valid)" name="submit" 
       id="submit" value="Save" class="submit" type="submit">
$scope.check = function(value) {
    if (value) {

why should this be done in the controller?

For example: <a ng-click="pluginsChanged ? restartServer($event) : null" href="/">Back</a> It's very obvious from just looking at the HTML, that when this link is clicked, if the plugins have changed then the server will be restarted, otherwise nothing special will happen. If I'd put that in the controller I'd have needed a separate function because I use restartServer elesewhere, and it wouldn't be obvious in the HTML what happens.

When another person later wonders why the server sometimes restarts when the back button is clicked, it will be immediately apparent. Rather than them having to go find the function and see under what condition it restarts.

It is a correct answer. Flow conditionals are part of the logic and should therefore be put in the controller. Angular provides if and show directives to "represent" changes, but even them should be feed through the controller.

javascript - if statement in ng-click - Stack Overflow

javascript angularjs
Rectangle 27 1

You currently have an xsl:if statement as a child of xsl:apply-templates which is not allowed in XSLT. If you only want to select Content elements with an Id value of "sam", you can put the condition in the select attribute of apply-templates, like so

<xsl:apply-templates select="BData/Content[Id='sam']" />
<xsl:stylesheet version="1.0" xmlns:xsl=""> 
  <xsl:template match="/Primary">
     <xsl:variable name="var" select="'sam'" />
     <xsl:apply-templates select="BData/Content[Id=$var]" />

  <xsl:template match="Content">
      <xsl:value-of select="Id" />

EDIT: The expression within the square brackets does not have to be just equals, it can be any valid expression, for example, if you wanted only Content elements whose Id started with "sam" or "bob", you would do this:

<xsl:apply-templates select="BData/Content[starts-with(Id, 'sam') or starts-with(Id, 'bob')]" />

Thanks a lot. It helped. But it isn't about direct match. Can I add string methods like starts_with() and logical operators instead of just [Id= $var]. Basically anything that is passed to 'test' in a tag.

Well, if you want an answer to a question, first you must ask the question, and the question you asked was how to "get the value of content/id tag with value 'sam'".... Having said that, in reply to you comment, you can indeed use more complex expressions here. I've amended my answer to show an example.

XSLT if matching all XML tag contents - Stack Overflow

xml xslt