問題タブ [extension-objects]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - Debugging XSLT with extension objects in Visual Studio 2010
I'm currently working on a project that involves a lot of XSLT transformations and I really need a debugger (I have XSLTs that are 1000+ lines long and I didn't write them :-).
The project is written in C# and makes use of extension objects:
From my knowledge, in this situation Visual Studio is the only tool that can help me debug the transformations step-by-step. The static debugger is no use because of the extension objects (it throws an error when it reaches elements that reference their namespace). Fortunately, I've found this thread which gave me a starting point (at least I know it can be done).
After searching MSDN, I found the criteria that makes stepping into the transform possible. They are listed here. In short:
- the XML and the XSLT must be loaded via a class that has the
IXmlLineInfo
interface (XmlReader
& co.) - the XML resolver used in the
XSLTCompiledTransform
constructor is file-based (XmlUriResolver
should work). - the stylesheet should be on the local machine or on the intranet (?)
From what I can tell, I fit all these criteria, but it still doesn't work. The relevant code samples are posted below:
I really don't get what I'm doing wrong. I've checked the interfaces on both XmlReader
objects and they implement the required one. Also, BaseUriXmlResolver
inherits from XmlUriResolver
and the stylesheet is stored locally. The screenshot below is what I get when stepping into the Transform
function. First I can see the stylesheet code after stepping through the parameters (on template-match), I get this:
If anyone has any idea why it doesn't work or has an alternative way of getting it to work I'd be much obliged :).
Thanks,
Alex
c# - .net 4 xslt 拡張オブジェクト
asp.net v3.5 Web アプリをアップグレード中です。XmlDataSource オブジェクトで使用する XSLT 変換でいくつかの問題に直面しています。
XSLT ファイルの一部:
そして、これは初期化です:
拡張オブジェクト:
私は前に同様の質問をしました: .net 4 xslt conversion 拡張機能が壊れています。あいまいな呼び出しについての答えは正しかったのですが、別の正しいオブジェクトを使用しても機能しません。エラーは表示されません。データが表示されないだけです。
私もこれを試しました。
これはコンソール アプリケーションでは適切に機能しますが、Web アプリケーションではセキュリティ例外が発生し、これ以上の詳細はありません。
[SecurityException: 要求が失敗しました。]
System.RuntimeMethodHandle.PerformSecurityCheck(Object obj、RuntimeMethodHandleInternal メソッド、RuntimeType 親、UInt32 invocationFlags) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj、BindingFlags invokeAttr、Binder バインダー、Object[] パラメーター、CultureInfo culture, Boolean skipVisibilityChecks) +323
System.Reflection.RuntimeMethodInfo.Invoke(オブジェクト obj, BindingFlags invokeAttr, バインダー バインダー, Object[] パラメータ, CultureInfo カルチャ) +38
System.Reflection.MethodBase.Invoke(オブジェクト obj, オブジェクト[] パラメータ) +35
System.Xml.Xsl.XsltOld.FuncExtension.Invoke(XsltContext xsltContext, Object[] args, XPathNavigator docContext) +164
MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator) +430
完全な信頼でローカルのasp.net v4 IIS7を実行しています。
ExtensionObjects で何が問題になる可能性がありますか。また、これをデバッグするのが非常に難しいのはなぜですか?拡張オブジェクトを使用して xslt をデバッグするための優れたツールはありますか?
ありがとうございます
c# - Xsltファイルの特殊文字
拡張オブジェクトのメソッドを呼び出しています。
これが私のメソッドのシグネチャです:
Xslt
そして、これが私のファイルで私がそれを呼んでいる場所です:
一部のため
[base:_entity / contact:_isMobile / base:_underlyingValue ='true']
'文字 が含まれています、エラーが発生します
"期待されるトークン')'、見つかった'true'。...isMobile / base:_underlyingValue ='-> true <-'] / base:_entity / contact:_extensi ... "
Xパスのエスケープ文字が見つかりませんでした。何か提案はありますか?
.net-3.5 - .NET xslt 拡張オブジェクトが見つかりません
こことそこからの例に従って、xmlファイルの存在をチェックする.NET xslt拡張オブジェクトを実装しようとしています。また、あまり役に立たなかったいくつかの関連する SO 投稿についても熟考しました。
次のコード スニペットで拡張機能を見つけようとすると、「拡張機能は使用できません」と表示されます。
...
...
次のように、同じ VS 2012 ソリューション内に XsltExtensionObject という名前の別のクラス ライブラリを作成しました (最初の例と一致するように VB で t を実行しました)。
次のように xsl 変換を実行します。
拡張子が見つからないのはなぜですか?ここで何が欠けていますか?アセンブリ参照?
xml - {http://exslt.org/dates-and-times}date-time() という名前の一致する引数なしの EXSLT 関数が見つかりません
IntelliJ IDEA 13 を使用しています。XSLT プロセッサは SAXON です。変換で日付と時刻を変換する必要があります。EXSLT を使用することにしました。変換に追加したものは次のとおりです。
「exslt」ディレクトリは、現在の変換ファイルと同じレベルにあります。EXSLT 関数を呼び出そうとする方法は次のとおりです。
コンパイルエラーは次のとおりです。
{ http://exslt.org/dates-and-times }date-time()という名前の一致する引数なしの関数が見つかりません。ローカル名 date-time を持つ Saxon 拡張関数はありません
私が間違っていることを教えてください。日付と時刻の拡張機能は通常、SAXON でネイティブにサポートされていると読みましたが、任意の XSLT プロセッサで変換を実行できるように EXSLT を選択しました。
delphi - Delphi 7 での XSL へのカスタム関数の追加
拡張オブジェクトで関数を使用するために XSL を取得しようとしていますが、関数が存在しないというメッセージが表示され続けます。
私のlib_TLB.pasファイルには、
function Get_ReadOnly: WordBool; safecall;
を実装するインターフェイスで定義されており、それをwithIDispatch
に渡していますIXSLProcessor
proc.AddObject( obj, 'foo' );
要素で宣言xmlns:foo="foo"
していますが、使用しようとすると、関数が存在しないとだけ言われます。xsl:stylesheet
<xsl:value-of select="foo:Get_ReadOnly()"/>
どこかで手順が抜けているのでしょうか、それとも呼び方が間違っているのでしょうか?
編集:詳しく調べてみると、プロパティのゲッターである関数では機能しません。その関数には関連付けられたプロパティがあり、正常に機能しましたfoo:get-ReadOnly()
。それか、そのインターフェイスの実装で定義されている関数が「パブリック」ではなく「保護」されているためです。
いずれにせよ、私が試行錯誤して手探りするのではなく、これがどのように機能するかについてのルールが何であるかを誰かが明らかにすることができれば、私は感謝しています.
xml - .NET を使用して XSLT を拡張するカスタム タグを作成する
カスタム関数と同様の方法で XSLT を拡張するカスタム タグを作成する方法はありますか?
すなわち(私のxsltファイルで):
期待される出力:
現在、私はこれをやっています:
私のcustomFuncはvbコードで次のようにします:
関数の代わりにタグを使いたい。
design-patterns - 拡張オブジェクト パターンとアダプター パターンの違いは何ですか?
この拡張オブジェクト パターンと、それがアダプター パターンとどのように違うのか説明してもらえますか?
拡張オブジェクト パターンを説明する Web のリソースはほとんどないようで、そのほとんどは (少なくとも私にとっては) 少しわかりにくいものです。
前もって感謝します。