我有以下代码应用XSLT样式
Test.Xml.xslTransform = function(xml, xsl) {
try {
// code for IE
if (window.ActiveXObject) {
ex = xml.transformNode(xsl);
return ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument) {
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml, document);
return resultDocument;
}
} catch (exception) {
if (typeof (exception) == "object") {
if (exception.message) {
alert(exception.message);
}
} else {
alert(exception);
}
}
Run Code Online (Sandbox Code Playgroud)
该代码适用于IE和Firefox,但不适用于Chrome和Safari.有什么想法吗?
更新
ResultDocument = xsltProcessor.transformToFragment(xml, document);
Run Code Online (Sandbox Code Playgroud)
上面的行返回null.没有错误被抛出.
更新
由于xslt文件包含xsl:include,因此代码无效.需要找到一种方法来使包含工作我将在此处粘贴进度
更新
我建议使用http://plugins.jquery.com/project/Transform/插件.我正在尝试使用客户端libary作为include的示例( …
The JVM is required to run a java application.
I wanted to know is there any equivalent in c#?
If yes what is it?
What exception is thrown in the .NET Framework when trying to write a file but the disk is full?
Does Windows buffer file writes?
当使用@login_required装饰器并设置LOGIN_URL变量时,我发现了一种信息泄漏.
我有一个网站,要求所有内容的强制登录.问题是,当它是现有页面时,您将被重定向到登录页面,并设置下一个变量.
所以当没有登录并要求:
http://localhost:8000/validurl/
Run Code Online (Sandbox Code Playgroud)
你看到了这个:
http://localhost:8000/login/?next=/validurl/
Run Code Online (Sandbox Code Playgroud)
在请求不存在的页面时:
http://localhost:8000/faultyurl/
Run Code Online (Sandbox Code Playgroud)
你看到了这个:
http://localhost:8000/login/
Run Code Online (Sandbox Code Playgroud)
这揭示了一些我不想要的信息.我想过覆盖login方法,强制下一个为空并在这个子类方法上调用'super'.
另一个问题是我的一些测试在没有设置LOGIN_URL的情况下失败.他们重定向到'/ accounts/login /'而不是'/ login /'.因此,为什么我想使用LOGIN_URL但禁用'自动下一个'功能.
谁可以对这个问题有所了解?
非常感谢.
杰拉德.
使用ASP.NET MVC和Spark,我有一个列出了大量搜索的视图.该视图顶部有以下声明:
<viewdata model="IEnumerable<SearchModel>" />
Run Code Online (Sandbox Code Playgroud)
在同一个搜索页面上,我还渲染了一个部分,用作弹出窗口的内容,使用户可以添加新的搜索.
我的问题是:在局部视图中我想使用强类型HTML帮助器并写:
${Html.TextBoxFor(model => model.SearchPhrase)}
Run Code Online (Sandbox Code Playgroud)
但当我添加另一个:
<viewdata model="CreateSearchModel" />
Run Code Online (Sandbox Code Playgroud)
在部分视图文件的顶部,Spark失败,只能声明一个viewdata模型.
我可以使用普通的HTML帮助程序,但是如何在这个局部视图中获得使用强类型HTML帮助程序的好处 - 或者有更好的方法吗?
我在SQL 2008中的表中创建了一个更新语句,该表使用一些错误的数据更新了表.
我没有DB的备份.
这是一些重要的日期,已经更新.
无论如何,我可以从表中恢复旧数据.
谢谢
SNA
假设我有一个简单的WPF 3D场景设置,其中一个矩形围绕X轴旋转-45度,如下所示:
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera Position="0,0,4"/>
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<DirectionalLight Color="White" Direction="-1,-1,-3" />
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D>
<ModelVisual3D.Content>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D Positions="-1,-1,0 1,-1,0 -1,1,0 1,1,0"
TriangleIndices="0,1,2 1,3,2"/>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="Red"/>
</GeometryModel3D.Material>
</GeometryModel3D>
</ModelVisual3D.Content>
<ModelVisual3D.Transform>
<Transform3DGroup>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="1,0,0" Angle="-45"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Transform3DGroup>
</ModelVisual3D.Transform>
</ModelVisual3D>
</Viewport3D>
Run Code Online (Sandbox Code Playgroud)
这给了我以下内容:
alt text http://www.freeimagehosting.net/uploads/4aa48434a9.png
现在我想围绕模型的Z轴旋转图像45度.如果我像这样放入第二个RotateTransform3D:
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,0,1" Angle="45"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
Run Code Online (Sandbox Code Playgroud)
它围绕场景的 Z轴旋转.对于这个特定的X旋转我已经找到了我需要的是:
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,1,1" Angle="45"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
Run Code Online (Sandbox Code Playgroud)
但在这里我的数学失败了.任何人都可以告诉我如何使用任意X(和Y,如果你想)轮换?
我有两个不同的活动.第一个发射第二个.在第二个活动中,我调用System.exit(0)以强制关闭应用程序,但是第一个活动会自动显示,而不是返回到主屏幕的应用程序.如何避免这种情况,让应用程序返回主屏幕?
我已经搜索了很多,但我找不到它的正确答案.我使用try_catch块进行此异常(如果抛出此异常,将向用户显示一个帧,我将告诉他/她一条消息)但是它仍然在控制台中显示异常.请帮助我.谢谢.
submit()方法将抛出此异常:
private void submit() throws ConnectException {
String id = idField.getText();
char[] pass1 = passField.getPassword();
String pass = new String(pass1);
if (id.equals("") || pass.equals("")) {
JOptionPane.showMessageDialog(this, "You should enter an ID and password", "Sign_In Problem", JOptionPane.OK_OPTION);
return;
} else {
boolean b = Manager.Test(id, pass);
if (b == true) {
this.setVisible(false);
Main.runAClient();
ListFrame frame = new ListFrame(client);
frame.setVisible(true);
} else {
JOptionPane.showMessageDialog(this, "You have entered wrong datas,try it again", "Sign_In Problem", JOptionPane.OK_OPTION);
return;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我使用netbeans,这是一个登录按钮的动作:
private void …Run Code Online (Sandbox Code Playgroud) 我有一个普通的 UIViewCONtroller(home),其中我有 IBAction 方法,例如
- (IBAction)goto1:(id)sender
{
self. goto1Controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:self. goto1Controller animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
它工作正常。goto1Controller 是一个普通的 UIViewcontroller,其中我通过用户定义的导航控制器使用了一个动作,通过它我转到另一个控制器,如 self.goto1Controller
- (IBAction)goto2:(id)sender
{
[userdefNavController pushViewController:goto2Controller animated:YES];
[self presentModalViewController: userdefNavController animated:NO];
}
Run Code Online (Sandbox Code Playgroud)
我从 goto2Controller 回到 goto1Controller 通过
[self dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
它工作正常...但是当我使用相同的方法([self deniedModalViewControllerAnimated:YES];)回家时,我必须按两次...而且当我再次按 - (IBAction)goto2:(id)sender从 goto2Controller 崩溃后发生..错误也是“不支持多次推送相同的视图控制器实例”有什么解决方案吗?我在我的 viewdidload 中有
userdefNavController = [[UINavigationController alloc] initWithRootViewController:self];
Run Code Online (Sandbox Code Playgroud) c# ×2
java ×2
.net ×1
3d ×1
android ×1
asp.net ×1
asp.net-mvc ×1
django ×1
django-urls ×1
geometry ×1
iphone ×1
javascript ×1
jquery ×1
math ×1
networking ×1
python ×1
safari ×1
sql ×1
wpf ×1
xslt ×1