|
Got it with "distinct-values"
<results>
{
let $a := doc("http://www.bn.com/bib.xml")//author
for $last in distinct-values($a/last),
$first in distinct-values($a[last=$last]/first)
return
<result>{$last}{$first}</result>
}
</results>
|
|
|
|
|
I'm trying to write an XPath query to match a node that has an attribute that contains a certain word. The obvious *[@attr="findme"] only works if the target attribute consists of *only* the word "findme". My target XML nodes might have the attribute "foo findme bar".
Using *[contains(@attr,"findme")] doesn't quite work either since it will also match a node if the attribute contains "x-findme", for example.
The best I've been able to come up with is this:
*[contains(concat(" ",concat(@class," ")," findme ")]
but this is obviously clumsy.
Is there a better way e.g. some way I can define my own XPath extension function called contains_word() that I can get MXSML to invoke?
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
|
That is XPath 2.0 and I am not aware of any support for it yet, is there?
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Ya, you're right. Unfortunately Microsoft sucks and doesn't support it. Of course apache and altova can read XPath 2. There aren't any cool extension functions that can stand in place of that either. I guess another thing that can be done is to sneak some script into the style sheet (if you're using a style sheet).
<msxsl:script language="JavaScript" implements-prefix="my-prefix">
<![CDATA[
function SomeFunction(text) { ... }
]]>
</msxsl:script>
...
<xsl:if test="my-prefix:SomeFunction('some text')">...
Logifusion[^]
|
|
|
|
|
And I just fired up my IDE to give it a go. Sigh...
Thanks for the suggestion anyway.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
Hello everyone,
I have a quick question with regards to .NET web services and WSE 3.0. If this is the wrong forum for this, I apologize. If you could direct me as to where to leave this on Code Project I’d appreciate it.
The short of it. I'd like to create a web service that will strictly communicate with a custom client. No other client should be able to gain access to the web service.
More details: The web service should not be able to talk to any other client or browsers out in the great unknown of the internet. However, the web service will be internet facing as the client will communicate with the web service over the internet. The client will be run from PCs which are not part of the same domain as the web service. In fact, the client-running machines will be freshly re-imaged (ghosted) computers.
Would anyone be able to make additional suggestions in regards to a solution? I’ve been researching this for sometime now. Some previous suggestions have included:
X.509 Certificate
Windows Certificate Authority service
Custom Binary Authentication (a custom PKI implementation, not using X.509)
Username / Password.
Custom (Calculated) hash value sent with message. “Computer Authorization Code”
Thank You Everyone,
Frank V.
JawzX02@yahoo.com
|
|
|
|
|
Jawz-X wrote: Some previous suggestions have included:
When it comes to security I would not consider any "custom" solutions.
http://en.wikipedia.org/wiki/WS-Security[^]
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
I would normally agree. However, at this time I'm tying to collect all possible solutions (my manager wants to see them, I suppose to consider all costs involved)
Anyway, I appreciate your post however that doesn't answer my question....
Thanks though!
Frank V.
JawzX2003@yahoo.com
|
|
|
|
|
Jawz-X wrote: Anyway, I appreciate your post however that doesn't answer my question....
depends on your definition of "additional suggestions" I considered it "additional" to recommend eliminating consideration of non-standard solutions suggested by other people.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Anyone know how to format a dictation rules XML file for the the Microsoft Speech 5.1 SDK? I've seen several example of command rules, but haven't found a single dictation example yet. All the sample source code I've found so far says: LoadDictation(NULL, ...)
TIA
>>>-----> MikeO
|
|
|
|
|
Sorry for bumb nood question.
I can't figure out how to transform an XML that I have in a string variable (not a file) using XSLT that is also in a string (not a file) and get the result as a string as well?
All I see there is "Load" methods which take paths to files or XmlReader (which I'm not sure how force to use my strings) or some other wierd stuff.
Please help!
|
|
|
|
|
inner wrote: XmlReader
string sxml = "<test>testing this</test>";
System.IO.StringReader reader = new StringReader(sxml);
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(XmlReader.Create(reader));
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
I face the same problem...
The point I have no solution to till now is making the XslCompiledTransform object put its output in a string variable...
Any idea???
|
|
|
|
|
Continuing from the previous example:
string strXml = ...;
string strXsl = ...;
XslCompiledTransform trans = new XslCompiledTransform();
trans.Load(XmlReader.Create(new StringReader(strXsl)));
StringBuilder sb = new StringBuilder();
trans.Transform(XmlReader.Create(new StringReader(strXml)), XmlWriter.Create(sb));
string outXml = sb.ToString();
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hi All,
Here Is my XSL file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simple"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="1.5cm"
margin-right="1.5cm">
<fo:region-body margin-top="2cm"/>
<fo:region-after extent="1.5cm"/>
<fo:region-before extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates select="Title"/>
<xsl:apply-templates select="TableEntries"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="Title">
<fo:block font-size="18pt"
font-family="sans-serif"
line-height="20pt"
space-after.optimum="1pt"
background-color="blue"
color="white"
text-align="center"
padding-top="3pt">
<xsl:value-of select="Heading"/>
</fo:block>
<fo:block font-size="16pt"
font-family="sans-serif"
line-height="18pt"
space-after.optimum="1pt"
background-color="blue"
color="white"
text-align="center"
padding-top="3pt">
<xsl:value-of select="DateCreated"/>
</fo:block>
</xsl:template>
<xsl:template match="TableEntries">
<fo:block width="510pt">
<fo:table table-layout="fixed" width="510pt">
<xsl:if test="ClientName">
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
</xsl:if>
<fo:table-body>
<fo:table-row>
<xsl:for-each select="TableInfo">
<xsl:if test="ClientName">
<fo:table-cell>
<fo:block>
Client Name
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="ClientName"/>
</fo:block>
</fo:table-cell>
</xsl:if>
</xsl:for-each>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Here is my Xml File:
<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='ClientLookUpResult.xsl'?>
<ClientLookUp>
<Title>
<Heading>Client Look-Up Result</Heading>
<DateCreated>Date Created: 06 July 2006 06:07PM</DateCreated>
</Title>
<TableEntries>
<TableInfo key="0">
<ClientName>Jan</ClientName>
</TableInfo>
<TableInfo key="1">
<ClientName>Koos</ClientName>
</TableInfo>
<TableInfo key="2">
<ClientName>Piet</ClientName>
</TableInfo>
<TableInfo key="3">
<ClientName>Gert</ClientName>
</TableInfo>
<TableInfo key="4">
<ClientName>San</ClientName>
</TableInfo>
</TableEntries>
</ClientLookUp>
When i run fop, it doesn't display anything...
Plz help.
He who laughs last...
|
|
|
|
|
Can you post what the XML:FO looks like after running the XML through this stylesheet. Offhand, it looks to me like these lines will never match anything:
<xsl:if test="ClientName">
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
</xsl:if>
Logifusion[^]
|
|
|
|
|
ok hold on... This is going to take a while
He who laughs last...
|
|
|
|
|
Sorry, but how do i get the xml:fo?
He who laughs last...
|
|
|
|
|
Try just applying the stylesheet to your XML outside of the FO processor. In FOP, you can use the command line option -foout.
Logifusion[^]
|
|
|
|
|
hi, i read up on this xmlfo file.
I'm using the cmd "path\fop.bat" -xml "path\filename.xml" -xsl "path\filename.xsl" -pdf "path\filename.pdf" in the cmd prompt to create the pdf. But in this way i never see the xmlfo file.
i read that i can use xalan.bat to create a xslfo file... but i have no idea how use the file with command prompt. it was easy with the fop.bat because the internet was full of helpfull stuff but no such luck with the xalan.bat as of yet...
how do you create your xmlfo files?
He who laughs last...
|
|
|
|
|
NarutoFan69 wrote: cmd "path\fop.bat" -xml "path\filename.xml" -xsl "path\filename.xsl" -pdf "path\filename.pdf"
Just modify your command:
path\fop.bat -xml "path\filename.xml" -xsl "path\filename.xsl" -foout "path\filename_out.xml"
Logifusion[^]
|
|
|
|
|
it runs but not as it would when i use -pdf as an out file...
the -foout gives me the options of all the possible outfiles and switches and then it starts...
[info]Using org.apache.xerces.parser.SAXParser as SAX2 Parser
[info]FOP 0.20.5
[info]using org.apache.xerces.parser.SAXParser as SAX2 Parser
[error]null
He who laughs last...
|
|
|
|
|
I'll take a look at it in a few minutes to see if I can produce an XML for you. You might have a different version of FOP, or there might be some kind of problem with the parsing.
Logifusion[^]
|
|
|
|
|
ok thank you but before you do i think i found something. Now i can display the "title" section in the pdf document i created...
instead of using <xsl:template match="/"> in the beginning, i'm using <xsl:temlate match="ClientLookUp">
and then i'm apply that template too.
Like this...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="ClientLookUp">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simple"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="1.5cm"
margin-right="1.5cm">
<fo:region-body margin-top="2cm"/>
<fo:region-after extent="1.5cm"/>
<fo:region-before extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:apply-templates select="ClientLookUp"/>
<xsl:apply-templates select="Title"/>
<xsl:apply-templates select="TableEntries"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="Title">
<fo:block font-size="18pt"
font-family="sans-serif"
line-height="20pt"
space-after.optimum="1pt"
background-color="blue"
color="white"
text-align="center"
padding-top="3pt">
<xsl:value-of select="Heading"/>
</fo:block>
<fo:block font-size="16pt"
font-family="sans-serif"
line-height="18pt"
space-after.optimum="1pt"
background-color="blue"
color="white"
text-align="center"
padding-top="3pt">
<xsl:value-of select="DateCreated"/>
</fo:block>
</xsl:template>
<xsl:template match="TableEntries">
<fo:block width="510pt">
<fo:table table-layout="fixed" width="510pt">
<xsl:if test="TableInfo/ClientName">
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
<fo:table-column column-width="50pt" font-size="7pt" border="1" border-color="black" border-style="solid" padding="2pt"/>
</xsl:if>
<fo:table-body>
<fo:table-row>
<xsl:for-each select="TableInfo">
<xsl:if test="ClientName">
<fo:table-cell>
<fo:block>
Client Name
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="ClientName"/>
</fo:block>
</fo:table-cell>
</xsl:if>
</xsl:for-each>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>
</xsl:stylesheet>
He who laughs last...
|
|
|
|